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 07:36:50 -0700 (PDT)

Thanks Paul,
 
 
Your answer is great! It has solved almost all of my questions!
 
> 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.
 
If there are multiple "install::" in one Makefile (I think it means multiple instances of one target in your mind), why need they be evaluated individually? I think they are the same target, so they should be treated the same (not necessary to be evaluated individually).
 
Another comment is that, I have not seen any relationship between your above point and .PHONY. Could you show me an example please?
> It's difficult to come up with a situation where this is useful, but not impossible
> I suppose.
 
Sorry I missed your context, what do you mean "this"?
 
 
regards,
George
"Paul D. Smith" <address@hidden> wrote:
%% Lin George writes:

lg> Do you also know the difference between :: and :? I can not
lg> understand what related parts of GNU make manual is talking about
lg> and there is also no samples in the manual dealing with this
lg> point.

Normally if you tried this, for example:

install:
cp foo $(DESTDIR)
install:
cp bar $(DESTDIR)

make would fail because you are defining multiple rules for a single
target. If you use "::" instead, it will work:

install::
cp foo $(DESTDIR)
install::
cp bar $(DESTDIR)

because here make keeps both targets; both commands will run when you
run "make install".

In this simple example it's not necessary; you could just write:

install:
cp foo $(DESTDIR)
cp bar $(DESTDIR)

and get the same behavior. However, double-colon rules can be very handy
if you have complex makefiles with lots of included makefiles, for
example; then each makefile can have its own "install::" target and you
don't have to worry about it.


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.

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


Blab-away for as little as 1ยข/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.
reply via email to

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