On Sun, 2007-12-02 at 12:53 +0000, Greg Chicares wrote:
> On 2007-12-02 07:41Z, N Galpin wrote:
> > 
> > I'd like to define multiple build targets in my makefile, and depending
> > on which target I pass to make, add different flags to $(CXXFLAGS).
> > 
> > For example, if i run `make release` I'd like this target to append
> > -O3 onto CXXFLAGS, or if I run `make debug`, I'd like to append
> > -g etc.
> 
> If you write something like this in your makefile:

This is a perfect job for target-specific variables.  Just say:

    release: CXXFLAGS += -O3
    release: all

    debug: CXXFLAGS += -g
    debug: all

Remember that these variables are inherited by the prerequisites of the
target they're defined for.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.us
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to