help-gnu-utils
[Top][All Lists]
Advanced

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

Make question: Specify which CXXFLAGS to use


From: William Payne
Subject: Make question: Specify which CXXFLAGS to use
Date: Wed, 13 Oct 2004 22:32:26 +0200

Hello, consider this Makefile:

CXX = g++
LD = g++
CXXFLAGS_DEBUG = -Wall -W -ansi -pedantic -g -ggdb -c -o
CXXFLAGS_RELEASE = -Wall -W -ansi -pedantic -O -c -o
LDFLAGS_DEBUG = -mwindows -lole32 -L/usr/local/gcc-3.4.2/lib/ -o $(EXEC)
LDFLAGS_RELEASE = -s -mwindows -lole32 -L/usr/local/gcc-3.4.2/lib/ -o 
$(EXEC)
EXEC = debug_file_remover
OBJECTS = \
 main_dialog_procedure.o \
 selected_directory_edit_box_procedure.o \
 winmain.o \
 debug_file_remover.res

debug: $(OBJECTS)
 $(LD) $(OBJECTS) $(LDFLAGS_DEBUG)

release: $(OBJECTS)
 $(LD) $(OBJECTS) $(LDFLAGS_RELEASE)

%.o: %.cpp
 $(CXX) $(CXXFLAGS) $@ $<

%.res: %.rc
 windres $< -O coff -o $@

clean:
 rm -f $(OBJECTS) $(EXEC) *~ *.stackdump

My problem is that depending on whether the user is doing "make debug" or 
"make release", I want to specify which CXXFLAGS_ to use.
Can I have a variable, say $CXXFLAGS, that I set to either $CXXFLAGS_DEBUG 
or RELEASE as appropiate? If so, how?

/ WP 




reply via email to

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