[Top][All Lists]

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

Re: Question about pattern rule with multiple targets

From: Tom Varga
Subject: Re: Question about pattern rule with multiple targets
Date: Fri, 27 Jun 2014 17:52:14 -0400

b.zoo1 really only depends on b.bar1
b.zoo2 really only depends on b.bar2

However, only one rule (and tool) is used to build both b.bar1 and b.bar2

I really don't want force b.zoo1 to artificially depend on b.bar2 as it's not a real dependency.

I was really just hoping to be able to convince gnumake that b.bar1 and b.bar2 are built with the same rule and MUST be consistent, that is both having been built at the same time and that both exist too.

On Fri, Jun 27, 2014 at 5:34 PM, Philip Guenther <address@hidden> wrote:
On Fri, Jun 27, 2014 at 11:24 AM, Tom Varga <address@hidden> wrote:
On page 120 of the gnumake manual, it mentions support for pattern
rules with multiple targets.

This pattern rule has two targets:
%.tab.c %.tab.h: %.y
bison -d $<

So, if I have a simple rule that looks like:

%.bar1 %.bar2 : %.foo
touch $(*F).bar1
touch $(*F).bar2

and then do:

> touch a.foo
> make a.bar1
touch a.bar1
touch a.bar2
> make a.bar1
make: 'a.bar1' is up to date.
> rm a.bar2
> make a.bar1
make: 'a.bar1' is up to date.
> make a.bar2
touch a.bar1
touch a.bar2

What I was really hoping is that make would consider both a.bar1 and
a.bar2 to be required outputs of the rule and if one of them is
deleted, then both the .bar1 and .bar2 targets should be considered
out-of-date.  But when I manually remove the a.bar2 file, the a.bar1
file is still considered to be up-to-date.  Yet, when I then ask to
build the a.bar2 target, both the a.bar1 and a.bar2 targets are

Umm, why isn't this solved by having a correct dependency on a.bar2 where necessary?

Philip Guenther

reply via email to

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