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 [SOLVED]


From: Paul Smith
Subject: Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]
Date: Sun, 13 Sep 2020 15:08:59 -0400
User-agent: Evolution 3.36.4-0ubuntu1

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 4 files copy1, copy2, copy3, copy4.

Sorry, I think the last time this came up I got side-tracked by the
fact that the example was using install.

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:

  <a1> <b2> ... : <prereqs>
          <command>

where <command> generates all targets with one invocation, then your
best bet is to modify this rule into two rules:

  <a1> <b2> ... : .sentinel ;

  .sentinel: <prereqs>
          <command>
          @touch $@

Note, it's critical to include the semicolon here.  Or if you prefer to
be more explicit you can write something like:

  <a1> <b2> ... : .sentinel
          : do nothing

This will work properly.




reply via email to

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