help-make
[Top][All Lists]
Advanced

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

Re: Is my Makefile okay?


From: Michael Ludwig
Subject: Re: Is my Makefile okay?
Date: Tue, 10 Jan 2012 00:31:16 +0100
User-agent: Mutt/1.5.20 (2009-12-10)

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 <address@hidden> 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



reply via email to

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