[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Conditionally add parameters to CXXFLAGS
From: |
Paul Smith |
Subject: |
Re: Conditionally add parameters to CXXFLAGS |
Date: |
Sun, 02 Dec 2007 09:06:41 -0500 |
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 <address@hidden> 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