Skip to content
Snippets Groups Projects
Verified Commit 123031dc authored by jD91mZM2's avatar jD91mZM2
Browse files

Fix race condition in parallel Makefile

Some recipes require the headers, but they don't explicitly say
so. Parallel make (-j`nproc`) might start compiling the libs when the
headers aren't done yet.
parent 3be13d67
No related branches found
No related tags found
No related merge requests found
...@@ -27,11 +27,12 @@ SRC=\ ...@@ -27,11 +27,12 @@ SRC=\
src/* \ src/* \
src/*/* \ src/*/* \
src/*/*/* \ src/*/*/* \
src/*/*/*/* src/*/*/*/* \
headers # Used by compiler-builtins
.PHONY: all clean fmt headers install install-headers libs test .PHONY: all clean fmt headers install install-headers libs test
all: | headers libs all: headers libs
clean: clean:
$(CARGO) clean $(CARGO) clean
...@@ -179,7 +180,7 @@ $(BUILD)/include: $(SRC) ...@@ -179,7 +180,7 @@ $(BUILD)/include: $(SRC)
mv $@.partial $@ mv $@.partial $@
touch $@ touch $@
$(BUILD)/openlibm: openlibm $(BUILD)/openlibm: openlibm headers
rm -rf $@ $@.partial rm -rf $@ $@.partial
mkdir -p $(BUILD) mkdir -p $(BUILD)
cp -r $< $@.partial cp -r $< $@.partial
...@@ -189,7 +190,7 @@ $(BUILD)/openlibm: openlibm ...@@ -189,7 +190,7 @@ $(BUILD)/openlibm: openlibm
$(BUILD)/openlibm/libopenlibm.a: $(BUILD)/openlibm $(BUILD)/include $(BUILD)/openlibm/libopenlibm.a: $(BUILD)/openlibm $(BUILD)/include
$(MAKE) CC=$(CC) CPPFLAGS="-fno-stack-protector -I$(shell pwd)/include -I $(shell pwd)/$(BUILD)/include" -C $< libopenlibm.a $(MAKE) CC=$(CC) CPPFLAGS="-fno-stack-protector -I$(shell pwd)/include -I $(shell pwd)/$(BUILD)/include" -C $< libopenlibm.a
$(BUILD)/pthreads-emb: pthreads-emb $(BUILD)/pthreads-emb: pthreads-emb headers
rm -rf $@ $@.partial rm -rf $@ $@.partial
mkdir -p $(BUILD) mkdir -p $(BUILD)
cp -r $< $@.partial cp -r $< $@.partial
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment