[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ifneq gnumake bug

From: Ted Stern
Subject: Re: ifneq gnumake bug
Date: Wed, 19 Nov 2003 13:36:57 -0800
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

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 :
    <TAB> @$(if $^,\
    <TAB>      echo "Dollar-carat = $^",\
    <TAB>      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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]