help-make
[Top][All Lists]
Advanced

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

Re: $(eval) does not work


From: Paul D. Smith
Subject: Re: $(eval) does not work
Date: Mon, 28 Feb 2005 08:34:22 -0500

%% Egil Moeller <address@hidden> writes:

  em> $(eval) can not currently be used to define new rules (and
  em> actually makes make core-dump)

To be clear, eval certainly _CAN_ be used to define new rules: that's
one of its primary uses.

It just can't be used to define new rules from within a command script
of a rule... the eval has to appear either in a simple variable setting
or, more typically, just sitting by itself at the beginning of a line in
the makefile.

  em> That is, auto-calculate dependencies for making a target when one
  em> knows that that target may have to be made. This can not be
  em> replaced with a static rule to calculate all automatic
  em> dependencies, as that would be way too much in some cases
  em> (%.texml: %.xml %.texml.deps in the above code matches _many_
  em> files).

  em> Is it possible to have make re-start the current run with a new
  em> make- file, similarly to "exec" in the shell?

Of course; that's a standard feature of GNU make and has been for years:
whenever make includes a makefile it will look to see if there are any
rules describing how that makefile can be remade.  If there are, and the
makefile is out of date, make will remake the makefile, then re-exec
itself.

Please see the section "How Makefiles Are Remade" in the GNU make
manual.

When you're done with that, you can read a full example of how this is
used to compute automatic dependencies for C files in the section
"Generating Prerequisites Automatically".

And when you're done with that, you can read the "Advanced
Auto-Dependency" whitepaper on my web site (below) for even more ideas
on this, which may or may not be relevant to your situation.

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