summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoshua stein <jcs@jcs.org>2019-12-27 23:50:39 -0600
committerAndreas Kling <awesomekling@gmail.com>2019-12-28 21:09:33 +0100
commit0b501335f55d96ab78251b75310f3417f8659c6d (patch)
tree925612dab1c0f44851fc4b6a607d90226a5de5de
parentd622e4d224acbe1a8dda3fcfb0bb1e1dab3f46f0 (diff)
downloadserenity-0b501335f55d96ab78251b75310f3417f8659c6d.zip
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.
-rw-r--r--AK/Tests/Makefile1
-rwxr-xr-xApplications/Browser/Makefile4
-rw-r--r--Libraries/LibAudio/Makefile2
-rw-r--r--Libraries/LibC/Makefile7
-rw-r--r--Libraries/LibGUI/Makefile2
-rw-r--r--Libraries/LibHTML/Makefile8
-rw-r--r--Libraries/LibProtocol/Makefile2
-rw-r--r--Makefile2
-rw-r--r--Makefile.common8
-rw-r--r--Makefile.subdir6
10 files changed, 21 insertions, 21 deletions
diff --git a/AK/Tests/Makefile b/AK/Tests/Makefile
index bd8ec67b83..1d517b8cd4 100644
--- a/AK/Tests/Makefile
+++ b/AK/Tests/Makefile
@@ -35,7 +35,6 @@ SHARED_TEST_OBJS = \
define execute-command
$(1)
-
endef
all: $(PROGRAMS)
diff --git a/Applications/Browser/Makefile b/Applications/Browser/Makefile
index a67bc091c9..e4843ac8cb 100755
--- a/Applications/Browser/Makefile
+++ b/Applications/Browser/Makefile
@@ -7,10 +7,10 @@ LIB_DEPS = GUI HTML Draw IPC Protocol Core
main.cpp: ../../Libraries/LibHTML/CSS/PropertyID.h
../../Libraries/LibHTML/CSS/PropertyID.h:
- @$(MAKE) -C ../../Libraries/LibHTML
+ @flock ../../Libraries/LibHTML $(MAKE) -C ../../Libraries/LibHTML
main.cpp: ../../Servers/ProtocolServer/ProtocolClientEndpoint.h
../../Servers/ProtocolServer/ProtocolClientEndpoint.h:
- @$(MAKE) -C $(dir $(@))
+ @flock ../../Servers/ProtocolServer $(MAKE) -C $(dir $(@))
include ../../Makefile.common
diff --git a/Libraries/LibAudio/Makefile b/Libraries/LibAudio/Makefile
index a7bda37485..ae2ec668ad 100644
--- a/Libraries/LibAudio/Makefile
+++ b/Libraries/LibAudio/Makefile
@@ -6,7 +6,7 @@ LIBRARY = libaudio.a
AClientConnection.cpp: ../../Servers/AudioServer/AudioClientEndpoint.h
../../Servers/AudioServer/AudioClientEndpoint.h:
- @$(MAKE) -C $(dir $(@))
+ @flock $(dir $(@)) $(MAKE) -C $(dir $(@))
install:
mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibAudio/
diff --git a/Libraries/LibC/Makefile b/Libraries/LibC/Makefile
index 76b3832838..ee3996b7ba 100644
--- a/Libraries/LibC/Makefile
+++ b/Libraries/LibC/Makefile
@@ -1,5 +1,3 @@
-.NOTPARALLEL:
-
AK_OBJS = \
../../AK/StringImpl.o \
../../AK/String.o \
@@ -62,7 +60,6 @@ OBJS = $(AK_OBJS) $(LIBC_OBJS)
EXTRA_OBJS = setjmp.ao crti.ao crtn.ao
crt0.o: crt0.cpp
- $(QUIET) $(CXX) $(CXXFLAGS) -o crt0.o -c crt0.cpp
crtio.o: crti.ao
$(QUIET) cp crti.ao crti.o
@@ -76,7 +73,9 @@ DEFINES = -DSERENITY_LIBC_BUILD
LIBRARY = libc.a
-all: crt0.o $(EXTRA_OBJS) $(LIBRARY) install
+POST_LIBRARY_BUILD = $(QUIET) $(MAKE) install
+
+all: crt0.o $(EXTRA_OBJS) $(LIBRARY)
install:
mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/sys/
diff --git a/Libraries/LibGUI/Makefile b/Libraries/LibGUI/Makefile
index 25f23cec2e..7d71bf950a 100644
--- a/Libraries/LibGUI/Makefile
+++ b/Libraries/LibGUI/Makefile
@@ -66,7 +66,7 @@ LIBRARY = libgui.a
GWindowServerConnection.cpp: ../../Servers/WindowServer/WindowServerEndpoint.h
../../Servers/WindowServer/WindowServerEndpoint.h:
- @$(MAKE) -C $(dir $(@))
+ @flock $(dir $(@)) $(MAKE) -C $(dir $(@))
install:
mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibGUI/
diff --git a/Libraries/LibHTML/Makefile b/Libraries/LibHTML/Makefile
index 1ff6b91919..6ce339aedb 100644
--- a/Libraries/LibHTML/Makefile
+++ b/Libraries/LibHTML/Makefile
@@ -71,10 +71,10 @@ GENERATE_CSS_PROPERTYID_CPP = CodeGenerators/Generate_CSS_PropertyID_cpp/Generat
GENERATE_CSS_PROPERTYID_H = CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h
$(GENERATE_CSS_PROPERTYID_H):
- @$(MAKE) -C $(dir $(GENERATE_CSS_PROPERTYID_H))
+ @flock $(dir $(GENERATE_CSS_PROPERTYID_H)) $(MAKE) -C $(dir $(GENERATE_CSS_PROPERTYID_H))
$(GENERATE_CSS_PROPERTYID_CPP):
- @$(MAKE) -C $(dir $(GENERATE_CSS_PROPERTYID_CPP))
+ @flock $(dir $(GENERATE_CSS_PROPERTYID_CPP)) $(MAKE) -C $(dir $(GENERATE_CSS_PROPERTYID_CPP))
CSS/DefaultStyleSheetSource.cpp: CSS/Default.css Scripts/GenerateStyleSheetSource.sh
@echo "GENERATE $@"
@@ -82,11 +82,11 @@ CSS/DefaultStyleSheetSource.cpp: CSS/Default.css Scripts/GenerateStyleSheetSourc
CSS/PropertyID.h: CSS/Properties.json $(GENERATE_CSS_PROPERTYID_H)
@echo "GENERATE $@"
- $(QUIET) $(GENERATE_CSS_PROPERTYID_H) $< > $@
+ $(QUIET) flock CSS $(GENERATE_CSS_PROPERTYID_H) $< > $@
CSS/PropertyID.cpp: CSS/Properties.json $(GENERATE_CSS_PROPERTYID_CPP)
@echo "GENERATE $@"
- $(QUIET) $(GENERATE_CSS_PROPERTYID_CPP) $< > $@
+ $(QUIET) flock CSS $(GENERATE_CSS_PROPERTYID_CPP) $< > $@
EXTRA_CLEAN = CSS/DefaultStyleSheetSource.cpp CSS/PropertyID.h CSS/PropertyID.cpp
diff --git a/Libraries/LibProtocol/Makefile b/Libraries/LibProtocol/Makefile
index fb5732a68d..3521c20a00 100644
--- a/Libraries/LibProtocol/Makefile
+++ b/Libraries/LibProtocol/Makefile
@@ -6,6 +6,6 @@ LIBRARY = libprotocol.a
Download.cpp: ../../Servers/ProtocolServer/ProtocolClientEndpoint.h
../../Servers/ProtocolServer/ProtocolClientEndpoint.h:
- @$(MAKE) -C $(dir $(@))
+ @flock $(dir $(@)) $(MAKE) -C $(dir $(@))
include ../../Makefile.common
diff --git a/Makefile b/Makefile
index 8ab4e9408b..31e79296d0 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,6 @@ ifeq ($(UNAME_S),Darwin)
test:
else
test:
- $(QUIET) $(MAKE) -C AK/Tests clean all clean
+ $(QUIET) flock AK/Tests $(MAKE) -C AK/Tests clean all clean
endif
diff --git a/Makefile.common b/Makefile.common
index 45ff967117..203bd090fb 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -103,19 +103,21 @@ $(PROGRAM): $(STATIC_LIB_DEPS) $(SUFFIXED_OBJS) $(EXTRA_OBJS)
$(LIBRARY): $(SUFFIXED_OBJS) $(EXTRA_OBJS)
@echo "LIB $@"
$(QUIET) $(AR) rcs $@ $(OBJS) $(EXTRA_OBJS) $(LIBS)
+ $(POST_LIBRARY_BUILD)
+#.PHONY: $(STATIC_LIB_DEPS)
$(STATIC_LIB_DEPS):
- @$(MAKE) -C $(dir $(@))
+ @flock $(dir $(@)) $(MAKE) -C $(dir $(@))
IPCCOMPILER = $(SERENITY_BASE_DIR)/DevTools/IPCCompiler/IPCCompiler
IPCCOMPILER: $(IPCCOMPILER)
$(IPCCOMPILER):
- @$(MAKE) -C $(dir $(@))
+ @flock $(dir $(@)) $(MAKE) -C $(dir $(@))
FORMCOMPILER = $(SERENITY_BASE_DIR)/DevTools/FormCompiler/FormCompiler
FORMCOMPILER: $(FORMCOMPILER)
$(FORMCOMPILER):
- @$(MAKE) -C $(dir $(@))
+ @flock $(dir $(@)) $(MAKE) -C $(dir $(@))
.DEFAULT_GOAL := all
diff --git a/Makefile.subdir b/Makefile.subdir
index b4e86913f8..f7f0e0cd07 100644
--- a/Makefile.subdir
+++ b/Makefile.subdir
@@ -1,17 +1,17 @@
subdirs: $(SUBDIRS)
$(SUBDIRS):
- @$(MAKE) -C $@
+ @flock $@ $(MAKE) -C $@
all: $(subdirs)
SUBDIRS_CLEAN = $(addsuffix .clean,$(SUBDIRS))
clean: $(SUBDIRS_CLEAN)
$(SUBDIRS_CLEAN): %.clean:
- @$(MAKE) -C $* clean
+ @flock $* $(MAKE) -C $* clean
SUBDIRS_INSTALL = $(addsuffix .install,$(SUBDIRS))
install: $(SUBDIRS_INSTALL)
$(SUBDIRS_INSTALL): %.install:
- @$(MAKE) -C $* install
+ @flock $* $(MAKE) -C $* install
.PHONY: all clean install $(SUBDIRS)