automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FYI] {master} compile: remove support for $(INCLUDES)


From: Stefano Lattarini
Subject: [FYI] {master} compile: remove support for $(INCLUDES)
Date: Fri, 28 Dec 2012 20:30:47 +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 <address@hidden>
Signed-off-by: Stefano Lattarini <address@hidden>
---
 NEWS                  |  5 +++++
 automake.in           | 29 ++++++++++++++---------------
 doc/automake.texi     | 14 ++++----------
 t/includes-no-more.sh | 32 ++++++++++++++++++++++++++++++++
 t/list-of-tests.mk    |  1 +
 t/pluseq5.sh          | 20 ++++----------------
 t/warnopts.sh         | 36 ++++++++++++++++++------------------
 t/werror2.sh          |  1 -
 8 files changed, 78 insertions(+), 60 deletions(-)
 create mode 100755 t/includes-no-more.sh

diff --git a/NEWS b/NEWS
index 2507499..a8b2cdd 100644
--- 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:
diff --git a/automake.in b/automake.in
index 35aefd3..96ff685 100644
--- a/automake.in
+++ b/automake.in
@@ -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);
diff --git a/doc/automake.texi b/doc/automake.texi
index b86770c..bac074c 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -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.
 
address@hidden INCLUDES
-This does the same job as @code{AM_CPPFLAGS} (or any per-target
address@hidden variable if it is used).  It is an older name for the
-same functionality.  This variable is deprecated; we suggest using
address@hidden 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,
address@hidden, @code{DEFAULT_INCLUDES}, @code{INCLUDES}, @code{CPPFLAGS}
-and @code{AM_CPPFLAGS} are also used.
address@hidden, @code{DEFAULT_INCLUDES}, @code{CPPFLAGS} and
address@hidden 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
address@hidden(F77) -F $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)@*
address@hidden(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
address@hidden(F77) -c $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)@*
address@hidden(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
index 0000000..eceaed6
--- /dev/null
+++ b/t/includes-no-more.sh
@@ -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
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 4612d3d..d835c8d 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -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 \
diff --git a/t/pluseq5.sh b/t/pluseq5.sh
index facab4e..64c5a6c 100755
--- a/t/pluseq5.sh
+++ b/t/pluseq5.sh
@@ -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
-
 :
diff --git a/t/warnopts.sh b/t/warnopts.sh
index 65165b7..b9a5385 100755
--- a/t/warnopts.sh
+++ b/t/warnopts.sh
@@ -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.
diff --git a/t/werror2.sh b/t/werror2.sh
index b1feeff..18b3698 100755
--- a/t/werror2.sh
+++ b/t/werror2.sh
@@ -37,7 +37,6 @@ $MAKE
 
 cat >Makefile.am <<END
 AUTOMAKE_OPTIONS = -Werror
-INCLUDES = -Ifoo
 foo_SOURCES = unused
 END
 
-- 
1.8.0.1.409.g252f922




reply via email to

[Prev in Thread] Current Thread [Next in Thread]