]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
compile: remove support for $(INCLUDES)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 22 Aug 2012 14:40:15 +0000 (16:40 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 28 Dec 2012 19:29:35 +0000 (20:29 +0100)
It has already been deprecated in the manual and by warnings in the
'obsolete' category for ages (at least since 2003), in favour of
AM_CPPFLAGS.  Automake-NG has removed support for it already.  And
the warnings in the obsolete category are on by default since the
1.12.4 release.

So, by removing it in Automake 1.14, we will simplify the transition
path for people that want to switch to Automake-NG.

See also Automake-NG commit v1.12-267-g6b74968 of 2012-05-21,
"[ng] compile: don't support $(INCLUDES) anymore, it's obsolete".

* NEWS, doc/automake.texi: Update.
* automake.in (generate_makefile): Reject INCLUDES unconditionally.
In all languages: don't add $(INCLUDES) to the compiler command line.
* t/includes-deprecation.sh: New test.
* t/list-of-tests.mk: Add it.
* t/werror2.sh : Adjust to avoid spurious failures.
* t/pluseq5.sh: Likewise.
* t/warnopts.sh: Likewise.

Suggested-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
automake.in
doc/automake.texi
t/includes-no-more.sh [new file with mode: 0755]
t/list-of-tests.mk
t/pluseq5.sh
t/warnopts.sh
t/werror2.sh

diff --git a/NEWS b/NEWS
index 250749947a0197c06e2c04e958cacc303a4e5180..a8b2cdd7fdeb691a5880de317d363172044dad35 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,11 @@ New in 1.14:
     over the same-named automake-provided macro, as defined in file
     '/usr/local/share/aclocal-1.14/vala.m4'.
 
+* Obsolete features:
+
+  - Support for the long-obsolete $(INCLUDES) variable has been finally
+    removed, in favour of the modern equivalent $(AM_CPPFLAGS).
+
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 New in 1.13:
index 35aefd329ea2a7a42fecc813c7464a08c107b7a1..96ff685656987096e8a55c650907ce8a7637b6ea 100644 (file)
@@ -704,7 +704,7 @@ register_language ('name' => 'c',
                   'flags' => ['CFLAGS', 'CPPFLAGS'],
                   'ccer' => 'CC',
                   'compiler' => 'COMPILE',
-                  'compile' => '$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
+                  'compile' => '$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
                   'lder' => 'CCLD',
                   'ld' => '$(CC)',
                   'linker' => 'LINK',
@@ -721,7 +721,7 @@ register_language ('name' => 'cxx',
                   'link' => '$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'CXX',
                   'flags' => ['CXXFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)',
+                  'compile' => '$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)',
                   'ccer' => 'CXX',
                   'compiler' => 'CXXCOMPILE',
                   'compile_flag' => '-c',
@@ -740,7 +740,7 @@ register_language ('name' => 'objc',
                   'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'OBJC',
                   'flags' => ['OBJCFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)',
+                  'compile' => '$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)',
                   'ccer' => 'OBJC',
                   'compiler' => 'OBJCCOMPILE',
                   'compile_flag' => '-c',
@@ -758,7 +758,7 @@ register_language ('name' => 'objcxx',
                   'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'OBJCXX',
                   'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS)',
+                  'compile' => '$(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS)',
                   'ccer' => 'OBJCXX',
                   'compiler' => 'OBJCXXCOMPILE',
                   'compile_flag' => '-c',
@@ -776,7 +776,7 @@ register_language ('name' => 'upc',
                   'link' => '$(UPCLD) $(AM_UPCFLAGS) $(UPCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'UPC',
                   'flags' => ['UPCFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)',
+                  'compile' => '$(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)',
                   'ccer' => 'UPC',
                   'compiler' => 'UPCCOMPILE',
                   'compile_flag' => '-c',
@@ -878,7 +878,7 @@ register_language ('name' => 'asm',
                   'config_vars' => ['CCAS', 'CCASFLAGS'],
 
                   'flags' => ['CCASFLAGS'],
-                  # Users can set AM_CCASFLAGS to include DEFS, INCLUDES,
+                  # Users can set AM_CCASFLAGS to include $(DEFS) or
                   # or anything else required.  They can also set CCAS.
                   # Or simply use Preprocessed Assembler.
                   'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)',
@@ -895,7 +895,7 @@ register_language ('name' => 'cppasm',
 
                   'autodep' => 'CCAS',
                   'flags' => ['CCASFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)',
+                  'compile' => '$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)',
                   'ccer' => 'CPPAS',
                   'compiler' => 'CPPASCOMPILE',
                   'compile_flag' => '-c',
@@ -949,7 +949,7 @@ register_language ('name' => 'ppfc',
                   'flags' => ['FCFLAGS', 'CPPFLAGS'],
                   'ccer' => 'PPFC',
                   'compiler' => 'PPFCCOMPILE',
-                  'compile' => '$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS)',
+                  'compile' => '$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS)',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
                   'libtool_tag' => 'FC',
@@ -959,9 +959,9 @@ register_language ('name' => 'ppfc',
 # Preprocessed Fortran 77
 #
 # The current support for preprocessing Fortran 77 just involves
-# passing "$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
-# $(CPPFLAGS)" as additional flags to the Fortran 77 compiler, since
-# this is how GNU Make does it; see the "GNU Make Manual, Edition 0.51
+# passing "$(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)"
+# as additional flags to the Fortran 77 compiler, since this is
+# how GNU Make does it; see the "GNU Make Manual, Edition 0.51
 # for 'make' Version 3.76 Beta" (specifically, from info file
 # '(make)Catalogue of Rules').
 #
@@ -981,7 +981,7 @@ register_language ('name' => 'ppf77',
                   'flags' => ['FFLAGS', 'CPPFLAGS'],
                   'ccer' => 'PPF77',
                   'compiler' => 'PPF77COMPILE',
-                  'compile' => '$(F77) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
+                  'compile' => '$(F77) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
                   'libtool_tag' => 'F77',
@@ -7830,9 +7830,8 @@ sub generate_makefile ($$)
     }
 
   # Catch some obsolete variables.
-  msg_var ('obsolete', 'INCLUDES',
-          "'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')")
-    if var ('INCLUDES');
+  reject_var 'INCLUDES', "'INCLUDES' is the obsolete name for " .
+                         "'AM_CPPFLAGS' (or '*_CPPFLAGS')";
 
   # Must do this after reading .am file.
   define_variable ('subdir', $relative_dir, INTERNAL);
index b86770cec13786a87961c02734d7ab574b341770..bac074cd55f04d48ef97c23e4067b26cbfdd3f24 100644 (file)
@@ -6072,12 +6072,6 @@ files in the source directory are ignored.
 @code{AM_CPPFLAGS} is ignored in preference to a per-executable (or
 per-library) @code{_CPPFLAGS} variable if it is defined.
 
-@item INCLUDES
-This does the same job as @code{AM_CPPFLAGS} (or any per-target
-@code{_CPPFLAGS} variable if it is used).  It is an older name for the
-same functionality.  This variable is deprecated; we suggest using
-@code{AM_CPPFLAGS} and per-target @code{_CPPFLAGS} instead.
-
 @item AM_CFLAGS
 This is the variable the @file{Makefile.am} author can use to pass
 in additional C compiler flags.  In some situations, this is
@@ -6410,8 +6404,8 @@ assembly code.  This compiler must work a bit like a C compiler; in
 particular it must accept @option{-c} and @option{-o}.  The values of
 @code{CCASFLAGS} and @code{AM_CCASFLAGS} (or its per-target
 definition) is passed to the compilation.  For preprocessed files,
-@code{DEFS}, @code{DEFAULT_INCLUDES}, @code{INCLUDES}, @code{CPPFLAGS}
-and @code{AM_CPPFLAGS} are also used.
+@code{DEFS}, @code{DEFAULT_INCLUDES}, @code{CPPFLAGS} and
+@code{AM_CPPFLAGS} are also used.
 
 The autoconf macro @code{AM_PROG_AS} will define @code{CCAS} and
 @code{CCASFLAGS} for you (unless they are already set, it simply sets
@@ -6500,7 +6494,7 @@ command used is as follows:
 @table @file
 
 @item .F
-@code{$(F77) -F $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)@*
+@code{$(F77) -F $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS)@*
 $(AM_FFLAGS) $(FFLAGS)}
 
 @item .r
@@ -6523,7 +6517,7 @@ is as follows:
 @code{$(F77) -c $(AM_FFLAGS) $(FFLAGS)}
 
 @item .F
-@code{$(F77) -c $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)@*
+@code{$(F77) -c $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS)@*
 $(AM_FFLAGS) $(FFLAGS)}
 
 @item .r
diff --git a/t/includes-no-more.sh b/t/includes-no-more.sh
new file mode 100755 (executable)
index 0000000..eceaed6
--- /dev/null
@@ -0,0 +1,32 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Support for $(INCLUDES) has been removed.
+
+. test-init.sh
+
+echo AC_PROG_CC >> configure.ac
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+INCLUDES = -DFOO
+END
+
+$ACLOCAL
+AUTOMAKE_fails -Wnone -Wno-error
+grep "^Makefile\\.am:2:.* 'INCLUDES'.* obsolete.* 'AM_CPPFLAGS'" stderr
+
+:
index 4612d3ded6ed601aa486f4e631b99944d3c25e82..d835c8d09fa4a58693591f438ec2c26f4fd53c77 100644 (file)
@@ -501,6 +501,7 @@ t/help-silent.sh \
 t/help-upc.sh \
 t/hfs.sh \
 t/implicit.sh \
+t/includes-no-more.sh \
 t/init.sh \
 t/init2.sh \
 t/insh2.sh \
index facab4e1dfe19639844db911991ffa1b93883086..64c5a6cda24dc29bf4d3e08e9a05e0c5801adf8f 100755 (executable)
@@ -24,9 +24,9 @@ END
 
 cat > Makefile.am << 'END'
 if CHECK
-INCLUDES = abc
+AM_CPPFLAGS = abc
 endif
-INCLUDES += def
+AM_CPPFLAGS += def
 END
 
 $ACLOCAL
@@ -34,10 +34,10 @@ AUTOMAKE_fails
 
 # We expect the following diagnostic:
 #
-# Makefile.am:4: cannot apply '+=' because 'INCLUDES' is not defined in
+# Makefile.am:4: cannot apply '+=' because 'AM_CPPFLAGS' is not defined in
 # Makefile.am:4: the following conditions:
 # Makefile.am:4:   !CHECK
-# Makefile.am:4: either define 'INCLUDES' in these conditions, or use
+# Makefile.am:4: either define 'AM_CPPFLAGS' in these conditions, or use
 # Makefile.am:4: '+=' in the same conditions as the definitions.
 
 # Is !CHECK mentioned?
@@ -45,16 +45,4 @@ grep ':.*!CHECK$' stderr
 # Is there only one missing condition?
 test $(grep -c ':  ' stderr) -eq 1
 
-# By the way, Automake should suggest using AM_CPPFLAGS,
-# because INCLUDES is an obsolete name.
-grep AM_CPPFLAGS stderr
-
-# A way to suppress the obsolete warning is to use
-# -Wno-obsolete:
-echo 'AUTOMAKE_OPTIONS = -Wno-obsolete' >> Makefile.am
-AUTOMAKE_fails
-grep AM_CPPFLAGS stderr && exit 1
-# !CHECK should still be mentioned.
-grep ':.*!CHECK$' stderr
-
 :
index 65165b731094f9897da9e592b095c86e66c2c07f..b9a5385824c6bf01f7a4c2b10c3de15683294c8e 100755 (executable)
@@ -20,6 +20,7 @@
 
 cat >>configure.ac <<END
 AC_CONFIG_FILES([sub/Makefile])
+AM_CONDITIONAL([COND_FALSE], [false])
 AC_OUTPUT
 END
 
@@ -28,38 +29,37 @@ mkdir sub
 # These two Makefile contain the same errors, but have different
 # warnings disabled.
 
-cat >Makefile.am <<END
-AUTOMAKE_OPTIONS = -Wno-obsolete
-INCLUDES = -Ifoo
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = -Wno-unsupported
+if COND_FALSE
+AUTOMAKE_OPTIONS += no-dependencies
+endif
 foo_SOURCES = unused
 SUBDIRS = sub
 END
 
-cat >sub/Makefile.am <<END
+cat > sub/Makefile.am << 'END'
 AUTOMAKE_OPTIONS = -Wno-syntax
-INCLUDES = -Ifoo
+if COND_FALSE
+AUTOMAKE_OPTIONS += no-dependencies
+endif
 foo_SOURCES = unused
 END
 
 $ACLOCAL
 AUTOMAKE_fails
 # The expected diagnostic is
-#   Makefile.am:3: warning: variable 'foo_SOURCES' is defined but no program or
-#                           library has 'foo' as canonical name (possible typo)
-#   sub/Makefile.am:2: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS'
+#   automake: warnings are treated as errors
+#   Makefile.am:5: warning: variable 'foo_SOURCES' is defined but no program or
+#   Makefile.am:5: library has 'foo' as canonical name (possible typo)
+#   sub/Makefile.am:1: warning: 'AUTOMAKE_OPTIONS' cannot have conditional contents
 grep '^Makefile.am:.*foo_SOURCES' stderr
-grep '^sub/Makefile.am:.*INCLUDES' stderr
-grep '^sub/Makefile.am:.*foo_SOURCES' stderr && exit 1
-grep '^Makefile.am:.*INCLUDES' stderr && exit 1
+grep '^sub/Makefile.am:.*AUTOMAKE_OPTIONS' stderr
+grep '^sub/Makefile.am:.*foo_SOURCES' stderr && Exit 1
+grep '^Makefile.am:.*AUTOMAKE_OPTIONS' stderr && Exit 1
 # Only three lines of warnings.
-test $(grep -v 'warnings are treated as errors' stderr | wc -l) -eq 3
+test $(grep -v 'warnings are treated as errors' stderr | wc -l) = 3
 
-# On fast machines the autom4te.cache created during the above run of
-# $AUTOMAKE is likely to have the same time stamp as the configure.ac
-# created below; thus causing traces for the old configure.ac to be
-# used.  We could do '$sleep', but it's faster to erase the
-# directory.  (Erase autom4te*.cache, not autom4te.cache, because some
-# bogus installations of Autoconf use a versioned cache).
 rm -rf autom4te*.cache
 
 # If we add a global -Wnone, all warnings should disappear.
index b1feeff217ec1650e5bc3c63a7e8012c2fd6a5af..18b3698f964ef42b0ac3ff055b159293980dffce 100755 (executable)
@@ -37,7 +37,6 @@ $MAKE
 
 cat >Makefile.am <<END
 AUTOMAKE_OPTIONS = -Werror
-INCLUDES = -Ifoo
 foo_SOURCES = unused
 END