From: Stefano Lattarini Date: Sun, 20 May 2012 21:29:11 +0000 (+0200) Subject: [ng] compile: don't support $(INCLUDES) anymore, it's obsolete X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b74968cf13acf27731a2afc4872fa6373c726e9;p=thirdparty%2Fautomake.git [ng] compile: don't support $(INCLUDES) anymore, it's obsolete The $(INCLUDES) variables has been since long supplanted and obsoleted by the $(AM_CPPFLAGS) variable (in documentation since the commit 3d248ab5 of 2001-06-12, "* automake.texi (Program variables): Document AM_CPPFLAGS. Deprecate INCLUDES", and in code since the commit '1415d22f' of 2002-07-09, "* automake.in (generate_makefile): Suggest using AM_CPPFLAGS instead of INCLUDES". So we can drop support for $(INCLUDES). * NG-NEWS, doc/automake-ng.texi: Update. * automake.in: Drop usages of $(INCLUDES) from several calls to 'register_language'. (generate_makefile): Don't explicitly warn about the definition of the $(INCLUDES) variable anymore. * t/pluseq5.sh: Adjusted to avoid using the INCLUDES variable. * t/werror2.sh: Likewise. * t/warnopts.sh: Likewise, and remove extra-verbose comment. Signed-off-by: Stefano Lattarini --- diff --git a/NG-NEWS b/NG-NEWS index 18aa0ce35..2fbc0e4c2 100644 --- a/NG-NEWS +++ b/NG-NEWS @@ -211,6 +211,12 @@ Miscellaneous Similarly, the $(mkinstallscripts) make variable is not defined anymore; one should use $(MKDIR_P) instead. +* The $(INCLUDES) variable is not anymore passed to the invocations of + compilers with a C-like preprocessing step (as are for example C, C++, + Objective C, preprocessed assembler ...). One should just use + $(AM_CPPFLAGS) instead, which has been supported and recommended for + a long time. + ----- Copyright (C) 2012 Free Software Foundation, Inc. diff --git a/automake.in b/automake.in index c38f1b378..c0fcd5b09 100644 --- a/automake.in +++ b/automake.in @@ -733,7 +733,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', @@ -750,7 +750,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', @@ -769,7 +769,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', @@ -787,7 +787,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', @@ -805,7 +805,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', @@ -907,7 +907,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, say, DEFS, # or anything else required. They can also set CCAS. # Or simply use Preprocessed Assembler. 'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)', @@ -924,7 +924,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', @@ -978,7 +978,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', @@ -988,11 +988,11 @@ 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 -# for 'make' Version 3.76 Beta" (specifically, from info file -# '(make)Catalogue of Rules'). +# 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'). # # A better approach would be to write an Autoconf test # (i.e. AC_PROG_FPP) for a Fortran 77 preprocessor, because not all @@ -1010,7 +1010,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', @@ -7766,11 +7766,6 @@ sub generate_makefile ($$) } } - # Catch some obsolete variables. - msg_var ('obsolete', 'INCLUDES', - "'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')") - if var ('INCLUDES'); - # Must do this after reading .am file. define_variable ('subdir', $relative_dir, INTERNAL); diff --git a/doc/automake-ng.texi b/doc/automake-ng.texi index b6522fe85..f1702fc55 100644 --- a/doc/automake-ng.texi +++ b/doc/automake-ng.texi @@ -6050,12 +6050,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. It is more fully documented elsewhere. @@ -6388,8 +6382,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 @@ -6478,8 +6472,7 @@ command used is as follows: @table @file @item .F -@code{$(F77) -F $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)@* -$(AM_FFLAGS) $(FFLAGS)} +@code{$(F77) -F $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)} @item .r @code{$(F77) -F $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)} @@ -6501,8 +6494,7 @@ is as follows: @code{$(F77) -c $(AM_FFLAGS) $(FFLAGS)} @item .F -@code{$(F77) -c $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)@* -$(AM_FFLAGS) $(FFLAGS)} +@code{$(F77) -c $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)} @item .r @code{$(F77) -c $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)} diff --git a/syntax-checks.mk b/syntax-checks.mk index 9b273cf33..957051a38 100644 --- a/syntax-checks.mk +++ b/syntax-checks.mk @@ -46,6 +46,7 @@ sc_perl_syntax \ sc_no_brace_variable_expansions \ sc_rm_minus_f \ sc_no_for_variable_in_macro \ +sc_old_includes_vars \ sc_mkinstalldirs \ sc_pre_normal_post_install_uninstall \ sc_perl_no_undef \ @@ -137,6 +138,20 @@ sc_no_for_variable_in_macro: exit 1; \ else :; fi +## Older, deprecated, and now invalid aliases for $(AM_CPPFLAGS). +sc_old_includes_vars: + @files="\ + $(xtests) \ + $(pms) \ + $(ams) \ + $(srcdir)/automake.in \ + $(srcdir)/doc/*.texi \ + "; \ + if grep -E '\bINCLUDES\b' $$files; then \ + echo '$$(INCLUDES) is deprecated, use $$(AM_CPPFLAGS) instead' >&2; \ + exit 1; \ + else :; fi + ## The script and variable 'mkinstalldirs' are obsolete. sc_mkinstalldirs: @files="\ diff --git a/t/pluseq5.sh b/t/pluseq5.sh index 5db9c47b3..83223ffc1 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 ': ' stderr | wc -l` = 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 1662d91d6..774a38a57 100755 --- a/t/warnopts.sh +++ b/t/warnopts.sh @@ -20,6 +20,7 @@ cat >>configure.ac <Makefile.am < 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 < 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:.*AUTOMAKE_OPTIONS' stderr grep '^sub/Makefile.am:.*foo_SOURCES' stderr && Exit 1 -grep '^Makefile.am:.*INCLUDES' 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` = 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. @@ -71,3 +71,5 @@ AC_OUTPUT END $ACLOCAL $AUTOMAKE + +: diff --git a/t/werror2.sh b/t/werror2.sh index 67e0e01f7..e77a85b6e 100755 --- a/t/werror2.sh +++ b/t/werror2.sh @@ -21,7 +21,7 @@ . ./defs || Exit 1 -echo AC_OUTPUT>>configure.ac +echo AC_OUTPUT >> configure.ac : > Makefile.am @@ -35,9 +35,8 @@ $AUTOCONF ./configure $MAKE -cat >Makefile.am < Makefile.am << 'END' AUTOMAKE_OPTIONS = -Werror -INCLUDES = -Ifoo foo_SOURCES = unused END