bug-make
[Top][All Lists]
Advanced

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

Re: Manual: Multiple outputs


From: Paul Smith
Subject: Re: Manual: Multiple outputs
Date: Mon, 03 May 2021 08:57:16 -0400
User-agent: Evolution 3.36.4-0ubuntu1

On Mon, 2021-05-03 at 12:55 +0200, Frank Heckenbach wrote:
> The manual (
> https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html 
> ) 
> describes various ways to handle commands with multiple outputs.

Just to remind, this is the mailing list for GNU make... the above
manual is for automake which is a different project; we have no input
into or control over their manual.  You should be emailing their list.

> One intermediate solution that's said to work except with phony
> dependencies doesn't actually seem to work:
> 
> % cat Makefile
> all: data.c data.h
> data.c data.h: data.foo
>         touch data.c data.h
> data.h: data.c
> 
> % rm -f data.[ch]; touch data.foo; make -j
> touch data.c data.h
> touch data.c data.h
> 
> It says "[...] therefore a parallel make will have to serialize the
> builds of data.c and data.h, and will detect that the second is no
> longer needed once the first is over." This doesn't seem to be so.
> 
> Am I missing something?

This example is wrong.  You need the data.h target to have a recipe
associated with it; it could be rewritten as:

  data.h: data.c ;

(note the extra semicolon).  Now it will work.

> More importantly (at least to me), the final paragraph of the page
> should really be first. After reading about increasingly more
> complex solutions to handle various corner cases, I found it *much*
> easier to just turn my rule into a pseudo-pattern rule a la:
> 
> %ata.c %ata.h: %ata.foo

Of course, this can't work if there's no common stem between the
targets.  It also requires GNU make, which is a restriction that not
all automake projects may be willing to accept.

In newer versions of GNU make there's a "grouped targets" feature which
allows explicit rules to behave like implicit rules WRT multiple
targets.  But again, this is only helpful for automake projects which
are willing to require a new-enough version of GNU make.




reply via email to

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