Hi, The GNU standards [1] say: "Try to make the build and installation targets, at least (and all their subtargets) work correctly with a parallel make."
But supporting parallel requires, in some cases, mechanical changes to a Makefile. How about if GNU make was improved to not require me to make these changes? Namely, consider this Makefile: =================================================== all : copy1 copy2 copy3 copy4 copy1 copy2 copy3 copy4: Makefile install -c -m 644 Makefile copy1 install -c -m 644 Makefile copy2 install -c -m 644 Makefile copy3 install -c -m 644 Makefile copy4 =================================================== Observe: * "rm -f copy?; make" works fine. * "rm -f copy?; make -j8" occasionally fails: $ rm -f copy? ; make -j8 install -c -m 644 Makefile copy1 install -c -m 644 Makefile copy1 install -c -m 644 Makefile copy1 install -c -m 644 Makefile copy1 install -c -m 644 Makefile copy2 install -c -m 644 Makefile copy2 install -c -m 644 Makefile copy2 install -c -m 644 Makefile copy2 install: cannot change permissions of 'copy2': No such file or directory install -c -m 644 Makefile copy3 Makefile:4: recipe for target 'copy2' failed make: *** [copy2] Error 1 make: *** Waiting for unfinished jobs.... install -c -m 644 Makefile copy3 install -c -m 644 Makefile copy3 install -c -m 644 Makefile copy4 install -c -m 644 Makefile copy4 install -c -m 644 Makefile copy4 The workaround is to introduce an intermediate target: =================================================== all : copy1 copy2 copy3 copy4 copy1 copy2 copy3 copy4: install-copies .PHONY: install-copies install-copies: Makefile install -c -m 644 Makefile copy1 install -c -m 644 Makefile copy2 install -c -m 644 Makefile copy3 install -c -m 644 Makefile copy4 =================================================== This is tedious, mechanical work. Couldn't GNU make implement the workaround by itself? Namely, when during a parallel make, it encounters a rule target1 ... targetN : dependencies STATEMENTS and none of the statements depends on the precise target ($@ or similar), it should transform that to the form target1 ... targetN : intermediate_target .PHONY: intermediate_target intermediate_target: dependencies STATEMENTS internally. $ make --version GNU Make 4.1 Best regards, Bruno [1] https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make