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
[EMAIL PROTECTED]

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


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to