[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setting a variable only on condition that a rule is applied?
From: |
Paul D. Smith |
Subject: |
Re: setting a variable only on condition that a rule is applied? |
Date: |
Mon, 29 Mar 2004 14:46:16 -0500 |
%% David Wuertele <address@hidden> writes:
dw> Can I set a variable only on condition that a rule is applied? For
dw> example:
If you have GNU make 3.80 you can say:
dw> dorule1:
dw> @echo in rule1
dw> RULE_DEPENDENT_VAR+=rule1text
Of course this won't work, because text after a TAB is the command
script and is passed to the shell to be evaluated. The shell tries to
run a command named "RULE_DEPENDENT_VAR+=rule1text" and fails.
dorule1:
@echo in rule1
$(eval RULE_DEPENDENT_VAR+=rule1text)
Note that this setting will happen as soon as make decides to run this
command, not after it runs the first line successfully.
Personally I'd probably just create a manifest file, something like:
dorule1:
@echo in rule1
@echo rule1text >> MANIFEST
--
-------------------------------------------------------------------------------
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