|
Boost : |
From: Dan Nuffer (dnuffer_at_[hidden])
Date: 2000-11-15 18:56:16
William Kempf wrote:
> resulting executable currently includes debug info (I'm not sure how
> to supply parameters to GNU make to allow the makefile to produce
> either debug or release builds, and the debug builds are currently
> more important).
One option is to add the following to the makefile:
ifdef DEBUG
CDEBUG += -g -DDEBUG ...etc...
OUTDIR := debug
else
CDEBUG += -O2 ...(optimizations or whatever release flags you want)
OUTDIR := release
endif
Then to build it debug you would type "make DEBUG=1" Default would be
release mode. You could also change "ifdef to ifndef" if you want debug
to be the default.
Another way to do it is to create two targets: release and debug
Then you can run "make debug". If you do it this way you have to
duplicate the rules for building cpp files:
$(DEBUGBUILDDIR)/%.o: %.cpp
$(CXX) -c $< -o $@ $(DEBUGCFLAGS)
$(RELEASEBUILDDIR)/%.o: %.cpp
$(CXX) -c $< -o $@ $(RELEASECFLAGS)
>
> I've eliminated all warnings in gcc using -Wall.
>
-W adds some additional warnings and is commonly used. IMHO it's good to
use it.
--Dan Nuffer
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk