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

Re: Is my Makefile okay? Michael Ludwig Wed Feb 01 04:06:32 2012

Paul Smith schrieb am 08.01.2012 um 22:31 (-0500):
> On Sun, 2012-01-08 at 22:18 -0500, Jeffrey Walton wrote:
> > On Sun, Jan 8, 2012 at 9:36 PM, Pelias <[EMAIL PROTECTED]> wrote:

> > > 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++.
> It's a common misconception, but CPPFLAGS is not for C++.  It's an
> unfortunate overlap that "CPP" is appropriate for both "C plus plus"
> and "C pre-processor", but the latter was common before C++ was even
> invented, and make dates back to those earlier days as well.

And to make it more confusing, with Microsoft NMAKE, CPPFLAGS and
CXXFLAGS are both for C++, or more exactly, CPP and CPPFLAGS are for
C++ files ending in ".cpp" while CXX and CXXFLAGS are for C++ files
ending in ".cxx". Though this be madness, yet there is method in 't.

> It breaks down like this:
>   CFLAGS: Compiler flags for the C compiler
> CXXFLAGS: Compiler flags for the C++ compiler
> CPPFLAGS: Preprocessor flags for both C and C++ preprocessor.

Michael Ludwig

Help-make mailing list