On Mon, Aug 8, 2011 at 9:30 AM, Oleksandr Gavenko <[email protected]> wrote:
> 08.08.2011 15:01, Jeffrey Walton пишет:
>>
>> On Mon, Aug 8, 2011 at 7:57 AM, Greg Chicares<[email protected]>
>>  wrote:
>>>
>>> On 2011-08-08 10:51Z, 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.
>>>>
>>>> So I think I've figured out how *not* to do it.
>>>>
>>>> I need to pick up debug or release, then invoke the `all` rule.  Can
>>>> anyone suggest a way that works?
>>>
>>> Untested:
>>>
>>> `make build_type=debug all` or `make build_type=release all`
>>>
>>> ifeq (debug,$(findstring debug,$(build_type)))
>>>  CXXFLAGS += -DDEBUG=1 -g3 -ggdb -O0
>>> endif
>>
>> Thanks Greg. I was trying to stay away from the flags style since its
>> less intuitive (we're targeting folks whose primary language might not
>> be C/C++).
>>
>>   `make debug` =>  easy, no user questions
>>   `make build_type=debug all` =>  what was that flag again?
>>
> How about:
>
> debug: CXXFLAGS += -DDEBUG=1 -g3 -ggdb -O0
> debug: all
>
> release: CXXFLAGS += -UDEBUG -O2
> release: all
>
> Read "6.11 Pattern-specific Variable Values".
Thanks Oleksandr  - you were right. I was treading water in Chapter 9,
when I should have been in 6.10 and 6.11.

Thanks,

Jeff

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

Reply via email to