[Top][All Lists]

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

Re: Process target only if prerequisite was processed?

From: Ian Dunbar
Subject: Re: Process target only if prerequisite was processed?
Date: Fri, 12 Nov 2004 20:38:31 +0900

In this case an action needs to be taken if either one of the
prerequisites were processed.  The "all" target doesn't generate a file.
It just runs a program.

Matt Perry | matt at primefactor dot com

Hi Matt,

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.

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 $@

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.789 / Virus Database: 534 - Release Date: 2004/11/07

reply via email to

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