help-make
[Top][All Lists]
Advanced

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

Re: How does $@ work in a make conditional?


From: J.T. Conklin
Subject: Re: How does $@ work in a make conditional?
Date: Fri, 14 Jan 2011 11:39:21 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, berkeley-unix)

JeffS <address@hidden> writes:
> My question: since $@  (apparently) expands to sms , shouldn't the
> "true" branch of the ifeq  conditional be executed (with the
> consequence that the output should read yep, they are equal)? [I am at
> a loss as to why the output is no, they are not equal.]

The ifeq conditional was evaluated long before the make recipe is.  If
you want to have a conditional in a recipe that uses automatic
variables, use the $(if ...) function.  

For your use case, it may help to have a utility function to do the
string comparison.

$(targets):
        echo current target is $@
        echo $(if $(call eq,$@,sms),yep they are equal,nope they're not equal)

    --jtc

-- 
J.T. Conklin



reply via email to

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