bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Bruno Haible
Subject: Re: "make -jN" requires mechanical changes to a Makefile
Date: Sun, 12 May 2019 22:23:12 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-145-generic; KDE/5.18.0; x86_64; ; )

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 copy3
> >         install -c -m 644 Makefile copy4
> > copy2 copy3 copy4: copy1
> > ===================================================
> 
> This is not fully-correct either:
> 
>   $ make
>   install -c -m 644 Makefile copy1
>   install -c -m 644 Makefile copy2
>   install -c -m 644 Makefile copy3
>   install -c -m 644 Makefile copy4
> 
>   $ rm copy3
> 
>   $ make
>   make: Nothing to be done for 'all'.

Indeed. Thank you for having spotted this; otherwise I would have put a
broken rule into GNU gettext.

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? The documentation page [1] explicitly does NOT mention
this use-case for multiple targets on the same rule.

You mentioned splitting the rule into one rule per file. But bison does not
work this way; it really produces two files at once. And for other rules
I mentioned Automake limitations.

Parallel make is of growing importance, because Debian now uses parallel builds
by default (quote: "debhelper >= 10 defaults to parallel build").

Bruno

[1] https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]