On Mon, Aug 8, 2011 at 8:13 AM, Paul Smith <[email protected]> wrote:
> 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
I did not know I could do this (I don't believe Stallman covers it in
his book on GNU Make, or perhaps he did not give an example).
I did try the following, which made things ill:
debug:
CXXFLAGS += -DDEBUG=1 -g3 -ggdb -O0
>
>
> 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 :-)
I think things might be workable now.
Thanks for the suggestions,
Jeffrey Walton
_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make