Hello,
I'm having a problem with a makefile script i'm trying to write.
I want to compile a C++ program in two possible ways: "make"
(default target, main) and "make debug". When i supply the debug
target, exactly the same as main should be built, but then with the
DEBUG flag (-g -D DEBUG).
This sounds really logical, but i can't find the answer anywhere
in the forums.
This is the script:
CXX=g++
CXXFLAGS=-ansi -std=c++98 -Wall -W
DEBUG=-g -D DEBUG
OBJS=main.o NgramCreator.o
main: $(OBJS)
$(CXX) $(OBJS) -o $@
$(OBJS): NgramCreator.h
$(CXX) $(CXXFLAGS) $(DEBUG) -c $*.cpp
clean:
rm -f *~ *.o main *.gch
I don't have a clue how to do this, can anybody help me?
Thanks
Steven