%% "Robert P. J. Day" <[EMAIL PROTECTED]> writes:

  rpjd>   ${SUBDIRS}:
  rpjd>         @echo "My target is [EMAIL PROTECTED]"
  rpjd>         @echo "My makefile variable contains [EMAIL PROTECTED]"
  rpjd>   ifneq "[EMAIL PROTECTED]" ""
  rpjd>         @echo "Yup, that variable is set."
  rpjd>   endif

This cannot work.

Make preprocessor statements are evaluated when the makefile is read in,
just like the C/C++ preprocessor.

The contents of rules, and in particular automatic variables like $@,
are only set when the rule is invoked.


You have to use SHELL syntax to test whether something is set in the
shell, not make syntax.

  rpjd> i want to call this with something like:

  rpjd>   $ make d2_MAKEFILE=d2make d2

  rpjd> and be able to test whether the corresponding variable is set within
  rpjd> the rule.

Try something like:

   ${SUBDIRS}:
         @echo "My target is [EMAIL PROTECTED]"
         @echo "My makefile variable contains [EMAIL PROTECTED]"
         @[ -n "[EMAIL PROTECTED]" ] && echo "Yup, that variable is set."

-- 
-------------------------------------------------------------------------------
 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://lists.gnu.org/mailman/listinfo/help-make

Reply via email to