help-make
[Top][All Lists]
Advanced

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

Re: Question on ifeq ()


From: John Graham-Cumming
Subject: Re: Question on ifeq ()
Date: Tue, 30 Aug 2005 09:34:14 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

Bhaskar G wrote:
I have a simple makefile as below. Even though the $(STATUS) value is 1 the ifeq doesnot gothrough this condition. I am using Gmake 3.80
on linux.

btc6l001$  gmake -f bg.mk
1
PASS
1 --BG


all:
        $(eval STATUS := $(shell ls blahblah> nul 2>&1 ;echo $$?))
        @echo $(STATUS)
ifeq ($(strip $(STATUS)),1)
        @echo "FAIL"
        @echo "$(STATUS) --BG1"
else
        @echo "PASS"
        @echo "$(STATUS) --BG"
endif

That's because the ifeq is evaluated when the Makefile is read in (i.e. before any commands are run) and at that point STATUS has not been defined and hence does not equal 1 and hence the all rule gets the else portion and will be defined as:

all:
        $(eval STATUS := $(shell ls blahblah> nul 2>&1 ;echo $$?))
        @echo $(STATUS)
        @echo "PASS"
        @echo "$(STATUS) --BG"

John.
--
John Graham-Cumming
address@hidden

Home: http://www.jgc.org/
POPFile: http://getpopfile.org/

Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/

PGP key: http://www.jgc.org/pgp/

LinkedIn: https://www.linkedin.com/profile?viewProfile=&key=1906611




reply via email to

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