help-make
[Top][All Lists]
Advanced

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

Re: about :: sign and % sign problems


From: Lin George
Subject: Re: about :: sign and % sign problems
Date: Wed, 26 Apr 2006 19:44:52 -0700 (PDT)

Thanks Paul!
 
 
> It only makes sense to think about this if the targets have different
> prerequisites:

> foo:: bar
> echo Update due to bar

> foo:: baz
> echo Update due to baz

> etc. Now, if foo is up-to-date with respect to bar, that rule will not
> be run. If it's out-of-date with respect to baz, that rule will be
> run.
 
Good example! I think the effect is the same as the following statements (I think either bar or baz is out of date, foo will be remade.),
 
foo: bar baz
echo something
 
except that it is not easy to detect whether foo is remade by bar or remade by baz. Is that correct?
 
> Usually, targets like "all", "install", "clean", etc. which are meant to
> perform an action, rather than update real files, will be declared .PHONY.

> Look up .PHONY in the GNU make manual.
 
I have read through related parts. Your description and re-read of this part make me more clear about what .PHONY means. Cool!
 

regards,
George
"Paul D. Smith" <address@hidden> wrote:
%% Lin George writes:

>> Another interesting thing is that each instance of the target is
>> evaluated independently and only those instances which are out of date
>> are invoked. In the above example presumably a file "install" never
>> exists so the target is always out of date (or more commonly, it's
>> declared .PHONY). It's difficult to come up with a situation where this
>> is useful, but not impossible I suppose.

lg> Sorry I missed your context, what do you mean "this"?

The thing being discussed in the above paragraph: having the targets
evaluated independently.

lg> If there are multiple "install::" in one Makefile (I think it
lg> means multiple instances of one target in your mind), why need
lg> they be evaluated individually? I think they are the same target,
lg> so they should be treated the same (not necessary to be evaluated
lg> individually).

It only makes sense to think about this if the targets have different
prerequisites:

foo:: bar
echo Update due to bar

foo:: baz
echo Update due to baz

etc. Now, if foo is up-to-date with respect to bar, that rule will not
be run. If it's out-of-date with respect to baz, that rule will be
run.

>> It's difficult to come up with a situation where this is useful,
>> but not impossible I suppose.

lg> Another comment is that, I have not seen any relationship between
lg> your above point and .PHONY. Could you show me an example please?

Usually, targets like "all", "install", "clean", etc. which are meant to
perform an action, rather than update real files, will be declared .PHONY.

Look up .PHONY in the GNU make manual.

--
-------------------------------------------------------------------------------
Paul D. Smith Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist


Yahoo! Mail goes everywhere you do. Get it on your phone.
reply via email to

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