[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on targets and goals
From: |
Paul Smith |
Subject: |
Re: Question on targets and goals |
Date: |
Mon, 08 Aug 2011 08:13:09 -0400 |
On Mon, 2011-08-08 at 06:51 -0400, Jeffrey Walton wrote:
> I would like to invoke make with a debug or release configuration, but
> without a rule:
> `make debug` or `make release`
>
> Later:
>
> ifeq ($(MAKECMDGOALS),debug)
> CXXFLAGS += -DDEBUG=1 -g3 -ggdb -O0
> endif
>
> Because I don't have a rule, I'm getting a make error:
> make: *** No rule to make target `debug'. Stop.
Why can't you add a rule? Just say:
debug release: all
In fact if you do this, you can take advantage of target-specific
variable inheritance, like this:
debug release: all
debug: CXXFLAGS += -DDEBUG=1 -g3 -ggdb -O0
which is exactly why inheritance was created in the first place.
If you can't add a rule and you can't use variable assignments
(regarding Greg's suggestion), then I think you're out of luck. It
seems you want a new behavior without changing any code, which is seldom
possible in the world of computers :-)
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist