help-make
[Top][All Lists]
Advanced

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

Re: Testing rule success


From: Paul Smith
Subject: Re: Testing rule success
Date: Mon, 30 Jul 2007 18:40:52 -0400

On Mon, 2007-07-30 at 09:34 -0500, David A. Greene wrote:
> > some_rule : some_file
> >       $(if $(DO_EXISTENCE_TEST_HERE),$(DO_GOODSTUFF),$(DO_BADSTUFF))
> >
> All right, I believe I'm completely on the wrong path here because
> $(if) and $(wildcard) aren't useful in rule actions since they get
> expanded when the Makefile is parsed, not when the rule is invoked.

That's not true.

The contents of a command script are evaluated when make is about to
invoke the shell, and not before (otherwise variables like $@ etc.
couldn't work, of course).

See the GNU make manual for a complete description of when evaluation
happens for different parts of the makefile.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          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




reply via email to

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