%% "atteson" <[EMAIL PROTECTED]> writes:

  a> Can someone explain why gmake outputs "goodbye" rather than "hello"
  a> with the following test makefile:

  a> %.a : b
  a> ifeq ($@,"a.a")
  a>     echo "hello"
  a> else
  a>     echo "goodbye"
  a> endif

Because, ifeq etc. are evaluated as make is reading in the makefile
(even if they seem to appear in a "rule context": ONLY lines beginning
with TAB are considered command scripts and passed to the shell.

On the other hand, automatic variables like $@ are set only when make is
trying to build the rules long after the makefiles have been read in.

So, $@ is always empty when you evaluate that ifeq.

-- 
-------------------------------------------------------------------------------
 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-gnu-utils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Reply via email to