Loading...

help-make@gnu.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Is my Makefile okay? Jeffrey Walton Wed Feb 01 04:03:08 2012

On Sun, Jan 8, 2012 at 10:28 PM, Philip Guenther <[EMAIL PROTECTED]> wrote:
> On Sun, Jan 8, 2012 at 7:18 PM, Jeffrey Walton <[EMAIL PROTECTED]> wrote:
>> On Sun, Jan 8, 2012 at 9:36 PM, Pelias <[EMAIL PROTECTED]> wrote:
>>>
>>> I'm new to GNU make so I would like to know if I made any mistakes in the 
>>> way
>>> I have written my Makefile.
>>> One thing I'm not sure whether to append -DDEBUG/-DNDEBUG to CPPFLAGS or to
>>> CFLAGS.
>>
>> If your make file is using both C and C++ files (and using implicit
>> rules), you will want to apply DEBUG/NDEBUG to both. Otherwise, use
>> CFLAGS for C and CPPFLAGS for C++.
>
> Not quite: the "CPP" in CPPFLAGS does not stand for "C++" but rather
> for "C preprocessor".  In the built-in rules, CPPFLAGS is part of the
> commands for both C and C++.  The variable that is passed to the C++
> compiler but not the C compiler is CXXFLAGS.
>
> So, if you want to pass a -D option to the C and C++ compiler, add it
> to CPPFLAGS.
Doh... you're right - my bad.

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