%% David Wuertele <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>          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


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to