autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to enable/disable my debug code?


From: narke
Subject: Re: How to enable/disable my debug code?
Date: Thu, 28 Jul 2011 10:22:10 +0800

On 27 July 2011 21:13, Gary V. Vaughan <address@hidden> wrote:
> On 27 Jul 2011, at 19:22, narke wrote:
>> Hi, Gary
>
> Howdy!
>
>> On 27 July 2011 14:36, Gary V. Vaughan <address@hidden> wrote:
>>> On 27 Jul 2011, at 12:56, narke wrote:
>>>> With a same set of autoconf/automake files, how to I distribute my
>>>> program that allows user to build it with or without debug code
>>>> enabled?  In my code, there are something like below:
>>>>
>>>> #if (__MY_DEBUG__)
>>>> ...
>>>> #endif
>>>>
>>>> Thanks in advance.
>>>
>>>
>>> For debug builds:
>>>
>>>  ./configure CFLAGS='-g' CPPFLAGS=-D__MY_DEBUG__
>>>
>>
>> For this approach, will it overwrite my already defined flags or just
>> append values to them?  It usual that my CPPFLAGS had already set as
>> something like "-I/my/include" in a Makefile.am
>
> If the Makefile.am's have been written correctly (as described in the
> info manual and elsewhere), then CPPFLAGS/CFLAGS/LDFLAGS/etc should not
> be *set* in Makefile.am (although of course they are referenced often)
> because those are in the users' namespace.  Instead, Makefile.am should
> be setting required (but not compiler specific!!) options inside
> AM_CPPFLAGS/AM_CFLAGS/AM_LDFLAGS/etc.  The info manuals will help you
> here. Anyway, even if Makefile.am sets these flags incorrectly, since
> you set the options at configure time as shown above, you might still
> get away with it, since the configure values are then spliced into the
> generated Makefile's.
>
> Cheers,
> --
> Gary V. Vaughan (gary AT gnu DOT org)
>
>

Gary,

Thanks! Understood.

-- 
Life is the only flaw in an otherwise perfect nonexistence
    -- Schopenhauer

narke
public key at http://subkeys.pgp.net:11371 (address@hidden)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]