%% Jeremy Broughton <[EMAIL PROTECTED]> writes:

  jb> I have the following sample makefile, which seems to produce the
  jb> following erroneous output, using the cygwin version 1.3.10:

The output is not erroneous.

  jb> target1.txt target2.txt :
  jb> ifneq "" "$^"
  jb>       @echo $^
  jb> else
  jb>       @echo this doesn't seem empty to me:  $^
  jb> endif

Someone else gave the answer: I'll elaborate a little bit.  It's
critically important to grasp the difference between make constructs,
like ifeq etc., and command line constructs, like the @echo ... lines.

Make constructs are evaluated as the makefile is read in.  Command line
constructs are evaluated when the command is about to be run.

Automatic variables, like $^, are only set in the context of the command
scripts.

So, when the ifneq is evaluated, when the makefile is being read in, the
value of $^ is the empty string.

Later on, when make is done reading the makefiles, starts to run the
rules, and decides to rebuild "target1.txt", it will set $^ to the value
of the prerequisite then evaluate the command script, so you get the
output you see.

  jb> Do you know if this is fixed in a newer cygwin release?

It will never be "fixed", because it is not a bug.

-- 
-------------------------------------------------------------------------------
 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


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

Reply via email to