serenity/Makefile.subdir
joshua stein 0b501335f5 Build: wrap make invocations with flock(1)
Lock each directory before entering it so when using -j, the same
dependency isn't built more than once at a time.

This doesn't get full -j parallelism though, since one make child
will be sitting idle waiting for flock to receive its lock and
continue making (which should then do nothing since it will have
been built already).  Unfortunately there's not much that can be
done to fix that since it can't proceed until its dependency is
built by another make process.
2019-12-28 21:09:33 +01:00

18 lines
386 B
Makefile

subdirs: $(SUBDIRS)
$(SUBDIRS):
@flock $@ $(MAKE) -C $@
all: $(subdirs)
SUBDIRS_CLEAN = $(addsuffix .clean,$(SUBDIRS))
clean: $(SUBDIRS_CLEAN)
$(SUBDIRS_CLEAN): %.clean:
@flock $* $(MAKE) -C $* clean
SUBDIRS_INSTALL = $(addsuffix .install,$(SUBDIRS))
install: $(SUBDIRS_INSTALL)
$(SUBDIRS_INSTALL): %.install:
@flock $* $(MAKE) -C $* install
.PHONY: all clean install $(SUBDIRS)