I have something like this:

#####################
BIN = bin.test
TARGETS = $(BIN)/exe

$(TARGETS): INCLUDES += -Ifoo

debug: DEFINES += -DDEBUG

$(TARGETS): $(BIN)/obj.o

all debug: $(TARGETS)

$(BIN)/%:
        @echo -e For \'$@\':\\n  DEFINES=\'$(DEFINES)\'\\n  \
            INCLUDES=\'$(INCLUDES)\'
#####################

My output is this:
$ make
For 'bin.test/obj.o':
 DEFINES=''
 INCLUDES='-Ifoo'
For 'bin.test/exe':
 DEFINES=''
 INCLUDES='-Ifoo'

So far so good, but when I do make debug...
$ make debug
For 'bin.test/obj.o':
 DEFINES=''
 INCLUDES='-Ifoo'
For 'bin.test/exe':
 DEFINES='-DDEBUG'
 INCLUDES='-Ifoo'

I need DEFINES to have it's debug value for both exe and obj.o.  What
am I doing wrong here?

DEFINES keeps its value for both targets (exe, obj.o) if I remove the
line:
    $(TARGETS): INCLUDES += -Ifoo
..but this is a necessary declaration.


I can get around this whole thing by replacing the line:
    debug: DEFINES += -DDEBUG
with this:
    ifeq ($(MAKECMDGOALS),debug) 
    DEFINES += -DDEBUG 
    endif

Is there some better way to do this (i.e. Is the preceding a no-no)?

Many thanks in advance!
Casey

-- 
Casey W. Liscum
Drexel University - Mathematics and Computer Science
"Now I can look at you in peace; I don't eat you any more."
         -- Franz Kafka, while admiring fish in an aquarium

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

Reply via email to