Quellcode durchsuchen

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.
jD91mZM2 vor 6 Jahren
Ursprung
Commit
123031dcfe
1 geänderte Dateien mit 5 neuen und 4 gelöschten Zeilen
  1. 5 4
      Makefile

+ 5 - 4
Makefile

@@ -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