ifneq gnumake bug

2003-11-19 Thread Jeremy Broughton




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

makefile:

target1.txt : dependency1.exists

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


Output:

D:\>gnumake target1.txt
This doesn't seem empty to me: dependency1.exists


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

Thanks.

Jeremy Broughton
Software Developer, IBM DB2 Development Environment
Phone: 905-413-2348   e-mail: [EMAIL PROTECTED]



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


Re: ifneq gnumake bug

2003-11-19 Thread Ted Stern
On 19 Nov 2003, Jeremy Broughton wrote:
> I have the following sample makefile, which seems to produce the following
> erroneous output, using the cygwin version 1.3.10:
>
> makefile:
>
> target1.txt : dependency1.exists
>
> target1.txt target2.txt :
> ifneq "" "$^"
>   @echo $^
> else
>   @echo this doesn't seem empty to me:  $^
> endif

Just another user speaking here --

I think you're misinterpeting the ifneq syntax.  Those are makefile lines that
are read on startup.  But automatic variables like $^, $?, $@, $*, etc. are
target-specific variables that are expanded when the target rule is executed.

For what you want, you want to use a make function that is run at evaluation
time, like this:

target1.txt target2.txt :
 @$(if $^,\
  echo "Dollar-carat = $^",\
  echo "this doesn't seem empty to me: $^")

Apologies if I get the syntax wrong, but I think you get the idea.
-- 
 Ted Stern Applications Group
 Cray Inc.   office: 206-701-2182
 411 First Avenue South, Suite 600 cell: 206-383-1049
 Seattle, WA 98104-2860 FAX: 206-701-2500

 Frango ut patefaciam -- I break that I may reveal
 (The Paleontological Society motto, equally apropos for debugging)



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