help-make
[Top][All Lists]
Advanced

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

Variable order of operations


From: Harvey Chapman
Subject: Variable order of operations
Date: Mon, 02 Mar 2009 10:56:09 -0500
User-agent: Postbox 1.0b7 (Macintosh/2009020805)

Instead of a lengthy explantion...

In the makefile below, the ifeq section gets evaluated *after* the "cgi" target. This is not what I want. Would someone please point out what I'm doing wrong?

Also, on a separate note, is it better to have one ".PHONY:" target or multiple, one for each phony target?

Thank you, Harvey.


ifndef DEBUG
DEBUG=0
endif

.PHONY: all cgi clean
all: cgi

ifeq ($(DEBUG),1)
    HIDE=
else
    HIDE=@
endif

# For some reason in this particular Makefile, the "ifeq" above gets evaluated AFTER
# the targets below. This is a quick hack around that.
HIDE=@

cgi:
#    @echo "DEBUG is \""$(DEBUG)"\""
#    @echo "HIDE is \""$(HIDE)"\""
    @echo "Building... " $@
$(HIDE) DEBUG="$(DEBUG)" GUMSTIX="$(GUMSTIX)" BUILD_ARM="$(BUILD_ARM)" CC="$(CC)" CXX="$(CXX)" AR="$(AR)" make -C cgi

clean:
$(HIDE) DEBUG="$(DEBUG)" GUMSTIX="$(GUMSTIX)" BUILD_ARM="$(BUILD_ARM)" CC="$(CC)" CXX="$(CXX)" AR="$(AR)" make -C cgi clean





reply via email to

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