[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Incorrect order of AM_CXXFLAGS and CXX_FLAGS?
From: |
Marcel Loose |
Subject: |
Incorrect order of AM_CXXFLAGS and CXX_FLAGS? |
Date: |
Tue, 23 Nov 2004 12:37:11 +0100 |
Hi,
Recently, I stumbled across the following problem. We use the
auto-tools in
our build environment and have some GNU G++ compiler flags predefined
-- they
are defined as CXXFLAGS in an m4-macro that is invoked during
configure.
Among these flags are "-Wall" and "-W".
I wanted to configure/compile one sub-package in our software tree with
an
extra flag "-Wno-unused-parameter". So I added a line AM_CXXFLAGS =
-Wno-unused-parameter to my Makefile.am. The problem is, however, that
it
doesn't work. Automake adds the compiler flag before the default
CXX_FLAGS,
and as a result -Wall overrides the -Wno-unused-parameter flag.
Now, I don't know whether this a GCC "bug", or not, but it would make
sense,
IMHO, to *append* AM_*FLAGS, rather than to *prepend* them. Especially
because GCC usually retains the last occurrence of a switch that
appears on
the command line more than once.
So, instead of the current definition in automake:
$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
$(CPPFLAGS)
$(AM_CXXFLAGS) $(CXXFLAGS),
wouldn't it be better if it were defined as:
$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS)
$(AM_CPPFLAGS)
$(CXXFLAGS) $(AM_CXXFLAGS)
Kind regards,
Marcel Loose
Please send replies to: loose AT astron DOT nl
- Incorrect order of AM_CXXFLAGS and CXX_FLAGS?,
Marcel Loose <=