[Top][All Lists]

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

Re: Expansion of recursively expanded variables

From: Paul D. Smith
Subject: Re: Expansion of recursively expanded variables
Date: Tue, 26 Feb 2002 09:12:13 -0500

%% Matt Hastie <address@hidden> writes:

Pls. try to avoid sending HTML to the mailing list; plain text is quite
sufficient.  Thanks!
  mh> foo:
  mh>  @echo "test" > bar
  mh>  @echo "bar = $(shell cat bar)"

  mh> I get the following error:
  mh> $ make
  mh> cat: cannot open bar
  mh> bar = 
  mh> From reading through the current bug list, it would appear as
  mh> though this behavior is manifested as a result of make's current
  mh> variable instantiation algorithm, which instantiates all variables
  mh> at the beginning of a rule.


  mh> With this limitation in place, it is impossible to 'make' a
  mh> Makefile from rules which may analyze the makefile under
  mh> construction, as follows:

  mh> include targets.d
  mh> targets.d : Makefile
  mh>     $(call create-rule-to-append-targets-file)
  mh>     $(call create-rule-to-analyze-and-append-targets-file) # fails,
  mh> because 
  mh>     # shell commands used to interpret the targets.d file contents are
  mh> executed
  mh>     # before the targets.d file is created.

Can you give me an idea of what the contents of these variables might
be, that cause this problem?  If they are $(shell ...) functions, then
why are you doing this?  Why not just write them directly as shell
commands in the command script?

If they aren't $(shell ...) functions, then how can they "interpret" a
file?  Make has no builtin functions that read files, etc.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "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]