Dear all,

I'm sorry for the simple problem.
But it's a bit stange.

I've got two makefiles as follows:

Makefile1:

ifdef DEBUG
DFLAG=-D DEBUG
else
DFLAG=
endif
debug: all
all:
       g++ $(DFLAG) -o function_pointer function_pointer.cpp -Wall
clean:
       rm -rf *~

--------------------------------------------------------------------
Makefile2:

.DEFAULT_GOAL := all

#ifeq ($(MAKECMDGOALS),debug)
DFLAG += -D DEBUG -g
#else
DFLAG=
#endif

obj = log.o

debug: all
all: $(obj)
       libtool --mode=link g++ $(DFLAG) -o libEGE.a log.o
log.o: log.h log.cpp
       g++ -c $(DFLAG) -o log.o log.cpp

.PHONY: clean
clean: emacsclean
       rm -rf *.o libEGE.a

emacsclean:
       rm -rf *~

--------------------------------------------------------------------

To the first makefile, if I invoke make DEBUG=1, I can add the DFLAG
variable to my makefile.
But to the second, though I invoke make DEBUG=1, the DFLAG variable is not
set.
My system is Debian. And I'm using gnu make.
Would anyone please explain why this happens for me?

Any help would be appreciated and thanks in advance.

Sincerely,
Kun
_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to