[PATCH] Small convenience patch to src/Makefile.am

Raja R Harinath harinath@cs.umn.edu
Mon Jun 19 15:27:00 GMT 2000


Benjamin Kosnik <bkoz@redhat.com> writes:

> >   -       @WERROR@ @WFMT_FLAGS@ @CPU_FLAGS@ @EXTRA_CXX_FLAGS@ \
> >   +       $(WERROR) @WFMT_FLAGS@ @CPU_FLAGS@ @EXTRA_CXX_FLAGS@ \
> >           @SECTION_FLAGS@ @SECTION_LDFLAGS@ @DEBUG_FLAGS@ 
> 
> 
> WERROR is not a shell variable. It's set with AC_SUBST in the autoconf 
> macros in acinclue.m4. I think this breaks the current behavior.

No, WERROR is a make variable.  Automake ensures that

  AC_SUBST(FOO)

in configure.in results in a line

  FOO = @FOO@

in Makefile.in, unless the Makefile.am explicitly sets FOO.  So, we
can use

  FOO_EXTRA = $(FOO)

instead of 

  FOO_EXTRA = @FOO@

Using the first variant allows us to override FOO on the make command
line with

  make FOO=bar

FOO_EXTRA will use 'bar' instead of whatever 'configure' substituted
for @FOO@.  This is not always desirable, but is definitely useful in
this case.
 
> > This used to work before, but doesn't now because of the
> > hardcoding of AC_CXXFLAGS to always include -Werror.
> 
> ? when ?

I could have worded this better.  With the current code, the Makefile
will read (assuming configure decided WERROR==-Werror):

  WERROR = -Werror
  ...
  AC_CXXFLAGS = -Werror ...

It is sometimes convenient to disable WERROR, without touching
anything else.  With my suggestion, the Makefile (not Makefile.am, not
Makefile.in) would look like

  WERROR = -Werror
  ...
  AC_CXXFLAGS = $(WERROR) ...

Now, we can override WERROR, and not have -Werror passed to the
compiler.

As to when, I'm not sure.  I'm reasonably sure that I used this
feature of overriding WERROR before.  I'm now unable to, without the
above patch.  I think this was changed in revision 1.12 of
src/Makefile.am.

[snip]
  -WERROR = @WERROR@
[snip]
  -AM_CXXFLAGS = -fno-implicit-templates \
  -             -Wall -Wno-format -W -Wwrite-strings -Winline $(WERROR) \
  -             $(OPTIMIZE_CXXFLAGS) $(AC_CXXFLAGS) 
[snip]
  +AC_CXXFLAGS = \
  +       @WERROR@ @FMTFLAGS@ @CPUFLAGS@ @EXTRA_CXX_FLAGS@ @DEBUGFLAGS@ 
[snip]
  +AM_CXXFLAGS = \
  +       $(FORMAT_CXXFLAGS) \
  +       -fno-implicit-templates \
  +       -Wall -Wno-format -W -Wwrite-strings -Winline \
  +       $(OPTIMIZE_CXXFLAGS) $(AC_CXXFLAGS) 

The first line basically didn't affect things, because automake anyway
ensures that such a line exists in Makefile.in.  I'm asking you to
restore the use of $(WERROR) instead of @WERROR@.

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash


More information about the Libstdc++ mailing list