On Sun, 13 Sep 2020 20:07:27 +0100 Bruno Haible wrote: > Continuing this thread from May 2019 > <https://lists.gnu.org/archive/html/bug-make/2019-05/msg00022.html>: > The problem was: > > How can a rule that generates multiple files be formulated so > that it works with parallel make? > > For example, a rule that invokes bison, or a rule that invokes > a different Makefile. For simplicity, here, use a rule that > creates 4 files copy1, copy2, copy3, copy4. > > =========================================== > 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 > ===========================================
I would say there are two obvious solutions to make this work with parallel make: 1) Allow the targets to be tuilt in paralllel: =========================================== all : copy1 copy2 copy3 copy4 copy1 copy2 copy3 copy4: Makefile install -c -m 644 Makefile $@ =========================================== However, this solution 1 will not work for a single command that generates multiple files, so we might need a solution 2: 2) Don't mention some of the extra targets: =========================================== all : copy1 copy1: 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 =========================================== regards Henrik