[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:
t1: var.sh
. $< && echo $$FOO
var.sh:
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 var.sh above).
--
-------------------------------------------------------------------------------
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
Re: target-specific variables, Ken Smith, 2004/03/15