|
From: | John Graham-Cumming |
Subject: | Re: multiple targets for a single command |
Date: | Wed, 05 Oct 2005 14:41:05 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104 |
Jonathan Baccash wrote:
Some commands create more than one result, and make (3.81beta3) behaves funny when I try to account for this. For example: #------------- a: b touch a b: c c: d touch c touch b #------------- Now, if file d exists, this works fine the first time. But then I touch d and get weird results: $ touch d $ make touch c touch b $ make touch a $ make make: `a' is up to date. I can make the "b: c" rule touch b to get it to work more properly, but is there a make bug here?... I'm expecting output more like:
Not a bug, but the fact that Make doesn't know about the 'touch b'. You should read Paul's rule for Makefiles: http://make.paulandlesley.org/rules.html
"2 Every non-.PHONY rule must update a file with the exact name of
its target. Make sure every command script touches the file "$@"-- not "../$@", or "$(notdir $@)", but exactly address@hidden That way you and GNU make always agree."Basically Make's doing what you told it to and you have a side effect in the rule that builds c. Essentially the answer here is don't do that, or if you do do it be aware of the consequence that Make doesn't know about b and may behave in an unexpected way.
Why do you need the rule for c to make b? John.
[Prev in Thread] | Current Thread | [Next in Thread] |