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)



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

Reply via email to