[fdo-dev] AM_CXXFLAGS instead of CXXFLAGS

Mateusz Loskot mateusz at loskot.net
Mon Aug 28 19:04:42 EDT 2006


Greg Boone wrote:
> This is a reasonable suggestion. Is the Makefile.am files the only
> locations that would have to change?

AFAIK, yes, only to Makefile.am.

It applies to CXXFLAGS substitution, for subdirectories, using
@CXXFLAGS@ placeholder, which usually is used in Makefile.am.

Usually, configure.in defines default flags used globally.
Every additional flags used locally in subdirectories
are set with AM_CXXFLAGS.
Similarly, there are also AM_CPPFLAGS and AM_LDFLAGS.

For example,

1. configure.in includes default flags definition:

CXXFLAGS="${CXXFLAGS} -Wall -ansi -pedantic -Wno-long-long"
----------^^^^^^^^^^ - important

This enables users to define custom flags as follows:

$ CXXFLAGS="-g -Wnonnull" ./configure

what will generate:

CXXFLAGS="-g -Wnonnull -Wall -ansi -pedantic -Wno-long-long"

2. If some subdirectory needs specific local flags,
then <path-to-subdir>/Makefile.am file comletes default flags definition
with local flags as follows:

AM_CXXFLAGS = -fPIC -Wuninitialized

what finally gives:

CXXFLAGS="-fPIC -Wuninitialized -Wnonnull -Wall -ansi -pedantic
-Wno-long-long"


The same way AM_CPPFLAGS and AM_LDFLAGS may be used.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net




More information about the Fdo-internals mailing list