Verified Commit 123031dc authored by jD91mZM2's avatar jD91mZM2

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
Pipeline #4135 failed with stages
in 14 minutes and 22 seconds
......@@ -27,11 +27,12 @@ SRC=\
src/* \
src/*/* \
src/*/*/* \
src/*/*/*/* \
headers # Used by compiler-builtins
.PHONY: all clean fmt headers install install-headers libs test
all: | headers libs
all: headers libs
$(CARGO) clean
......@@ -179,7 +180,7 @@ $(BUILD)/include: $(SRC)
mv $@.partial $@
touch $@
$(BUILD)/openlibm: openlibm
$(BUILD)/openlibm: openlibm headers
rm -rf $@ $@.partial
mkdir -p $(BUILD)
cp -r $< $@.partial
......@@ -189,7 +190,7 @@ $(BUILD)/openlibm: openlibm
$(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
$(BUILD)/pthreads-emb: pthreads-emb
$(BUILD)/pthreads-emb: pthreads-emb headers
rm -rf $@ $@.partial
mkdir -p $(BUILD)
cp -r $< $@.partial
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment