automake
[Top][All Lists]
Advanced

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

[PATCH] {master} compile: remove support for $(INCLUDES) (was: Re: Autom


From: Stefano Lattarini
Subject: [PATCH] {master} compile: remove support for $(INCLUDES) (was: Re: Automake vs. Automake-NG)
Date: Wed, 22 Aug 2012 17:12:05 +0200

On 08/21/2012 06:03 PM, Paolo Bonzini wrote:
>
>> Looking at GNU Smalltalk, I see:
>>
>> * warn for INCLUDES (vs. AM_CPPFLAGS)
>>
Turns out this has already been done for ages (at least since 2003).
I'll just remove support for it in Automake 1.13.  See the patch
below.

OK?

Regards,
  Stefano

-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----

>From 54a49542d417850e646fefe7bad56546a2362449 Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Wed, 22 Aug 2012 16:40:15 +0200
Subject: [PATCH] compile: remove support for $(INCLUDES)

It has already been deprecated in the manual and by warnings in the
'obsolete' categories for ages (at least since 2003), in favour of
AM_CPPFLAGS.  Automake-NG has removed support for it already.

So, by removing it in Automake 1.13, 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                  |  3 +++
 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         | 38 +++++++++++++++++++-------------------
 t/werror2.sh          |  1 -
 8 files changed, 77 insertions(+), 61 deletions(-)
 create mode 100755 t/includes-no-more.sh

diff --git a/NEWS b/NEWS
index 59b86ea..bea113e 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,9 @@ New in 1.13:
     option) has been removed.  See discussion about automake bug#11034
     for more background.

+  - Support for the long-obsolete $(INCLUDES) variable has been finally
+    removed, in favour of the modern equivalent $(AM_CPPFLAGS).
+
   - The automake-provided '@mkdir_p@' configure substitution and
     AM_PROG_MKDIR m4 macro have been removed.  They had been obsolete
     since automake 1.10, and actively deprecated since Automake 1.12.1.
diff --git a/automake.in b/automake.in
index 95ecbef..deb45f2 100644
--- a/automake.in
+++ b/automake.in
@@ -703,7 +703,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',
@@ -720,7 +720,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',
@@ -739,7 +739,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',
@@ -757,7 +757,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',
@@ -775,7 +775,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',
@@ -877,7 +877,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)',
@@ -894,7 +894,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',
@@ -948,7 +948,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',
@@ -958,9 +958,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').
 #
@@ -980,7 +980,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',
@@ -7908,9 +7908,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 e4614ab..a73cec1 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -6079,12 +6079,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.  It is more fully documented elsewhere.
@@ -6417,8 +6411,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
@@ -6507,7 +6501,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
@@ -6530,7 +6524,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..7bd78aa
--- /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 $(INCLUDES) has been removed.
+
+. ./defs || exit 1
+
+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 a299262..be80ddd 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -493,6 +493,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 914e3b7..bd2cd9a 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 68ceb2a..4f7c1a0 100755
--- a/t/warnopts.sh
+++ b/t/warnopts.sh
@@ -16,10 +16,11 @@

 # Make sure that we can enable or disable warnings on a per-file basis.

-. ./defs || exit 1
+. ./defs || Exit 1

 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 52ec181..e2666ea 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.7.12



reply via email to

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