Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]

2020-09-14 Thread Henrik Carlqvist
On Mon, 14 Sep 2020 12:15:58 +0200 Bruno Haible wrote: > Henrik Carlqvist wrote: > > 2) Don't mention some of the extra targets: > > === > > all : copy1 > > > > copy1: Makefile > > install -c -m 644 Makefile copy1 > > install -c -m 644 Makefile

Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]

2020-09-14 Thread Bruno Haible
Henrik Carlqvist wrote: > 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

Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]

2020-09-13 Thread Henrik Carlqvist
On Sun, 13 Sep 2020 20:07:27 +0100 Bruno Haible wrote: > Continuing this thread from May 2019 > : > The problem was: > > How can a rule that generates multiple files be formulated so > that it works with parallel make? > >

Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]

2020-09-13 Thread Bruno Haible
Hi Paul, > There is a straightforward and portable way to do this even with > traditional make, it's just not as nice (but, nicer than changing all > the recipes to use test IMO! :)). > > If you have a rule like this: > > ... : > > > where generates all targets with one

Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]

2020-09-13 Thread Paul Smith
On Sun, 2020-09-13 at 15:08 -0400, Paul Smith wrote: > ... : .sentinel ; > > .sentinel: > > @touch $@ Just to be clear, you don't have to use ".sentinel" you can use any target name, and obviously you must use a different name for each "grouping" of targets that needs

Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]

2020-09-13 Thread Bruno Haible
> === > all : copy1 copy2 copy3 copy4 > > copy1: Makefile > { test -f copy1 && test ! copy1 -ot Makefile; } || { rm -f copy4; > $(MAKE) copies; } > copy2: copy1 > { test -f copy2 && test ! copy2 -ot copy1; } || { rm -f copy4; $(MAKE) > copies;

Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]

2020-09-13 Thread Paul Smith
On Sun, 2020-09-13 at 20:55 +0200, Bruno Haible wrote: > 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

Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]

2020-09-13 Thread Howard Chu
Bruno Haible wrote: > Continuing this thread from May 2019 > : > 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

Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]

2020-09-13 Thread Bruno Haible
Continuing this thread from May 2019 : 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

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-13 Thread Edward Welbourne
> Howard Chu wrote: > > >> Example with one rule creating 4 files: > > >> > > >> 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

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-12 Thread Henrik Carlqvist
On Mon, 13 May 2019 00:05:59 +0200 Bruno Haible wrote: > Howard Chu wrote: > > >> Example with one rule creating 4 files: > > >> > > >> all : copy1 > > >> > > >> copy1: Makefile > > >> install -c -m 644 Makefile copy1 > > >> install -c -m 644 Makefile copy2 > > >>

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-12 Thread Bruno Haible
Howard Chu wrote: > >> Example with one rule creating 4 files: > >> > >> 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 >

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-12 Thread Howard Chu
Bruno Haible wrote: > Henrik Carlqvist wrote: >> Example with one rule creating 4 files: >> >> 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

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-12 Thread Bruno Haible
Henrik Carlqvist wrote: > Example with one rule creating 4 files: > > 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 I think the

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-12 Thread Henrik Carlqvist
On Sun, 12 May 2019 22:23:12 +0200 Bruno Haible wrote: > Now, when my use-case is: > - one rule that produces N files (N > 1), > - I want "make" to execute the rule only once, not N times, > even with parallel make. > What is the solution? I think that the only good solution is to make

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-12 Thread Bruno Haible
Hi Paul, > > The real workaround goes like this: > > > > === > > all : copy1 copy2 copy3 copy4 > > > > copy1: Makefile > > install -c -m 644 Makefile copy1 > > install -c -m 644 Makefile copy2 > > install -c -m 644 Makefile

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-12 Thread Paul Smith
On Sun, 2019-05-12 at 18:07 +0200, Bruno Haible wrote: > This workaround doesn't actually work (in the actual case of GNU gettext): > it fails the "make distcheck" verification. > > The real workaround goes like this: > > === > all : copy1 copy2

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-12 Thread Bruno Haible
Hi, I wrote: > 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

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-10 Thread Bruno Haible
Henrik Carlqvist wrote: > If you really prefer to write rules which generates more than one target > the "right" way to avoid parallel make would be to add the .NOTPARALLEL > target in the Makefile. This way allows to turn off parallel make for a single Makefile. Indeed, this might be a better

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-10 Thread Henrik Carlqvist
> In the current state, supporting parallel make requires extra work > for the maintainer. > > Or would you recommend that I add this snippet to the top-level > Makefile of all my projects? > > # This package does not support parallel make. > # So, turn off parallel execution (at least in GNU

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-10 Thread Bruno Haible
Hi Paul, > This makefile should be written correctly, as: > > all : copy1 copy2 copy3 copy4 > > copy1: Makefile > install -c -m 644 Makefile copy1 > copy2: Makefile > install -c -m 644 Makefile copy2 > copy3: Makefile > install -c -m 644 Makefile copy3 >

Re: "make -jN" requires mechanical changes to a Makefile

2019-05-10 Thread Paul Smith
On Fri, 2019-05-10 at 22:49 +0200, Bruno Haible wrote: > 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: >

"make -jN" requires mechanical changes to a Makefile

2019-05-10 Thread Bruno Haible
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