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.
This commit is contained in:
jD91mZM2
2019-05-11 08:04:03 +02:00
parent 3be13d672f
commit 123031dcfe
+5 -4
View File
@@ -27,11 +27,12 @@ SRC=\
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
clean:
$(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