Hi,
I'm a kind of a newbie with makefiles and I'd like to create a target named "debug" or something similar which will use some special optimization flags useful when debugging (for example -ggdb). At the moment my makefile is neat (which I like) and looks like
Code:
SRC = $(wildcard *.cxx)
OBJ = $(SRC:.cxx=.o)
INCDIR = -I.
LIB = -lm
LIBDIR =
CXX = g++
LD = $(CXX)
CXXFLAGS = -Wextra -Wall -W #-pedantic #-Weffc++
CXXFLAGS += -ansi -pg -ggdb3 #-std=c++0x
CXXFLAGS += -O3 -march=native
LDFLAGS = -ggdb3 -pg
.SUFFIXES : .o .cxx .hxx
.cxx.o :
$(CXX) $(CXXFLAGS) $(INCDIR) -c $< -o $*.o
# targets
a.out : $(OBJ)
$(LD) $(LDFLAGS) $(OBJ) $(LIBDIR) $(LIB) -o $@
files :
@echo $(SRC)
all : clean depend a.out
clean :
/bin/rm -f *.o a.out gmon.out
depend :
gccmakedep -- $(INCDIR) -- $(SRC)
Now, I'd like to have a debug target that uses different CXXFLAGS. How can one do that?
Thanks!