Thanks Greg,
A great answer! I often use -I -D -l -L to compile/build program/shared library. Do you have any comments or suggestions about whether I should add -I (-D, -l and -L) to CXXFLAGS or CPPFLAGS? What about other options -Wall, -Wl, ... etc. regards, George --- Greg Chicares <[EMAIL PROTECTED]> wrote: > On 2006-5-3 12:42 UTC, Lin George wrote: > > > > I have read through the section you recommended, > but I > > can not find the relationship between CXXFLAGS and > > CPPFLAGS (for example, CXXFLAGS includes CPPFLAGS) > -- > > $(CXXFLAGS) doesn't "include" $(CPPFLAGS). They're > distinct. > > The convention is to use them both together for C++. > To build a C++ > program, traditionally at least three tools are > needed, and each has > its own flags for flexibility and clarity: > $(CPPFLAGS) for $(CPP), the C preprocessor > $(CXXFLAGS) for $(CXX), the C++ compiler > $(LDFLAGS) for $(LD), the linker > > 10.2 Catalogue of Implicit Rules > | Compiling C++ programs > | n.o is made automatically from n.cc, n.cpp, or > n.C with a command > | of the form `$(CXX) -c $(CPPFLAGS) $(CXXFLAGS)'. > > > to my surprise, instead I found that CPPFLAGS is > used > > for C (not C++)? > > C++ uses the C preprocessor. That's part of the > language's definition. > > 14.3 Variables for Specifying Commands > | Use CPPFLAGS in any compilation command that runs > the preprocessor > > > Here is the original text from GNU > > make manual, > > > > -------------------- > > CXXFLAGS Extra flags to give to the C++ compiler. > > CPPFLAGS Extra flags to give to the C preprocessor > and > > programs that use it (the C and > > Fortran compilers). > > -------------------- > > Read the parenthetical statement as: > (for example, the C, C++, and Fortran compilers) > > I'm not sure it's possible to list every language > that uses the C > preprocessor, though. Perhaps "Objective C" does; I > wouldn't know. > How about Walter Bright's "D" language? Or "C with > Classes"? > Or "B"? Or "BCPL"? > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
