[Top][All Lists]

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

Re: target-specific variables

From: Paul D. Smith
Subject: Re: target-specific variables
Date: Sun, 14 Mar 2004 17:47:22 -0500

%% Sven Köhler <address@hidden> writes:

  >> If you told us what you were trying to do at a higher level then
  >> maybe we'd have more to say.

  sk> I'm trying to execute a shell command and store the result in a
  sk> variable. since each command for a rule is executed in its own
  sk> sub-shell, i cannot easily use shell-vars, so i wanted to use
  sk> make-vars, but that doesn't seem to be possible :-(

So, you're trying to preserve a value to be used between different
rules, but you only want it to take effect if those rules are invoked,
is that it?

One simple thing to do would be to write the value to a file then source
the file in the command script of the other rules:

        . $< && echo $$FOO
        echo 'FOO=bar' > $@

Alternatively, you could use $(eval ...) but getting it into the right
spot might be tricky: you'd want to put it into the command script for
the _leaf_ target in that series (for example, in above).

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "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]