help-make
[Top][All Lists]
Advanced

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

Re: Process target only if prerequisite was processed?


From: Noel Yap
Subject: Re: Process target only if prerequisite was processed?
Date: Fri, 12 Nov 2004 07:49:17 -0500
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

Ian Dunbar wrote:

If prereq1 and prereq2 are files, then make will already do the right
thing for you.  Since you say "all" does not generate a file, you should
declare it phony as follows.

.PHONY: all

Doesn't .PHONY do exactly the opposite of what is wanted here though? .PHONY will always cause the "all command" to be processed, when what is wanted (I think) is to only do it when one of the prereqs has been processed.

No, it won't.  Try it out.

It will, however, ignore any existing files named "all" when considering to "build" the 
"all" target.

If you change it so that the "all" target actually does create a a file then I think it will be closer to what is described.

all: prereq1 prereq2
   @echo "$? was/were updated"
   <some commands you want to run>
   touch $@

This isn't necessary.  Judging from the requirements as given, Ken is 
completely correct.  Try it out.  Then read the docs.

Noel





reply via email to

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