mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
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.
This commit is contained in:
parent
d622e4d224
commit
0b501335f5
|
@ -35,7 +35,6 @@ SHARED_TEST_OBJS = \
|
|||
|
||||
define execute-command
|
||||
$(1)
|
||||
|
||||
endef
|
||||
|
||||
all: $(PROGRAMS)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
2
Makefile
2
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue