automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 4/4] compile: rename make variable DEFAULT_INCLUDES


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 4/4] compile: rename make variable DEFAULT_INCLUDES -> AM_DEFAULT_INCLUDES
Date: Mon, 28 May 2012 11:35:05 +0200

The automake-generated variable 'DEFAULT_INCLUDES' has never been
documented, and it violates user namespace.  So rename it to
'AM_DEFAULT_INCLUDES', to make it clear that it is owned by Automake.
We prefer that name to something that would sound more "private", like
'am__default_includes', because there are possibly legitimate usages
of that variable on the user's part.

* automake.in, lib/am/compile.am: Do the rename.
* NG-NEWS, doc/automake-ng.texi: Update.
* t/confh4.sh, t/no-extra-makefile-code.sh: Adjust.
* syntax-checks.mk (old_vars_checks): Add new check
'sc_no_DEFAULT_INCLUDES'.
(modern_DEFAULT_INCLUDES): Define to 'DEFAULT_INCLUDES'.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 NG-NEWS                     |    5 +++++
 automake.in                 |   18 +++++++++---------
 doc/automake-ng.texi        |    2 +-
 lib/am/compile.am           |    6 +++---
 syntax-checks.mk            |    1 +
 t/confh4.sh                 |    8 ++++----
 t/no-extra-makefile-code.sh |    3 +--
 7 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/NG-NEWS b/NG-NEWS
index 5250741..7d5b680 100644
--- a/NG-NEWS
+++ b/NG-NEWS
@@ -272,6 +272,11 @@ Miscellaneous
   So we've renamed it to 'AM_CONFIG_HEADERS'.  Do not override its value
   in your Makefiles!
 
+* The Automake-generated make variable 'DEFAULT_INCLUDES', used internally
+  in compilation rules and basically never documented in mainline Automake,
+  has been renamed to AM_DEFAULT_INCLUDES, to avoid impinging on the user's
+  namespace.  Do not override this variable in your Makefiles!
+
 -----
 
 Copyright (C) 2012 Free Software Foundation, Inc.
diff --git a/automake.in b/automake.in
index e23049c..86ea066 100644
--- a/automake.in
+++ b/automake.in
@@ -719,7 +719,7 @@ register_language ('name' => 'c',
                   'flags' => ['CFLAGS', 'CPPFLAGS'],
                   'ccer' => 'CC',
                   'compiler' => 'COMPILE',
-                  'compile' => '$(CC) $(DEFS) $(DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
+                  'compile' => '$(CC) $(DEFS) $(AM_DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
                   'lder' => 'CCLD',
                   'ld' => '$(CC)',
                   'linker' => 'LINK',
@@ -736,7 +736,7 @@ register_language ('name' => 'cxx',
                   'link' => '$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) 
$(LDFLAGS) -o $@',
                   'autodep' => 'CXX',
                   'flags' => ['CXXFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(CXX) $(DEFS) $(DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)',
+                  'compile' => '$(CXX) $(DEFS) $(AM_DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)',
                   'ccer' => 'CXX',
                   'compiler' => 'CXXCOMPILE',
                   'compile_flag' => '-c',
@@ -755,7 +755,7 @@ register_language ('name' => 'objc',
                   'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) 
$(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'OBJC',
                   'flags' => ['OBJCFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)',
+                  'compile' => '$(OBJC) $(DEFS) $(AM_DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)',
                   'ccer' => 'OBJC',
                   'compiler' => 'OBJCCOMPILE',
                   'compile_flag' => '-c',
@@ -773,7 +773,7 @@ register_language ('name' => 'objcxx',
                   'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) 
$(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'OBJCXX',
                   'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS)',
+                  'compile' => '$(OBJCXX) $(DEFS) $(AM_DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS)',
                   'ccer' => 'OBJCXX',
                   'compiler' => 'OBJCXXCOMPILE',
                   'compile_flag' => '-c',
@@ -791,7 +791,7 @@ register_language ('name' => 'upc',
                   'link' => '$(UPCLD) $(AM_UPCFLAGS) $(UPCFLAGS) $(AM_LDFLAGS) 
$(LDFLAGS) -o $@',
                   'autodep' => 'UPC',
                   'flags' => ['UPCFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(UPC) $(DEFS) $(DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)',
+                  'compile' => '$(UPC) $(DEFS) $(AM_DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)',
                   'ccer' => 'UPC',
                   'compiler' => 'UPCCOMPILE',
                   'compile_flag' => '-c',
@@ -910,7 +910,7 @@ register_language ('name' => 'cppasm',
 
                   'autodep' => 'CCAS',
                   'flags' => ['CCASFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)',
+                  'compile' => '$(CCAS) $(DEFS) $(AM_DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)',
                   'ccer' => 'CPPAS',
                   'compiler' => 'CPPASCOMPILE',
                   'compile_flag' => '-c',
@@ -964,7 +964,7 @@ register_language ('name' => 'ppfc',
                   'flags' => ['FCFLAGS', 'CPPFLAGS'],
                   'ccer' => 'PPFC',
                   'compiler' => 'PPFCCOMPILE',
-                  'compile' => '$(FC) $(DEFS) $(DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS)',
+                  'compile' => '$(FC) $(DEFS) $(AM_DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS)',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
                   'libtool_tag' => 'FC',
@@ -974,7 +974,7 @@ register_language ('name' => 'ppfc',
 # Preprocessed Fortran 77
 #
 # The current support for preprocessing Fortran 77 just involves
-# passing "$(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)"
+# passing "$(DEFS) $(AM_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
@@ -996,7 +996,7 @@ register_language ('name' => 'ppf77',
                   'flags' => ['FFLAGS', 'CPPFLAGS'],
                   'ccer' => 'PPF77',
                   'compiler' => 'PPF77COMPILE',
-                  'compile' => '$(F77) $(DEFS) $(DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
+                  'compile' => '$(F77) $(DEFS) $(AM_DEFAULT_INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
                   'libtool_tag' => 'F77',
diff --git a/doc/automake-ng.texi b/doc/automake-ng.texi
index 80db240..86b3b3d 100644
--- a/doc/automake-ng.texi
+++ b/doc/automake-ng.texi
@@ -6383,7 +6383,7 @@ 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{CPPFLAGS} and
address@hidden, @code{AM_DEFAULT_INCLUDES}, @code{CPPFLAGS} and
 @code{AM_CPPFLAGS} are also used.
 
 The autoconf macro @code{AM_PROG_AS} will define @code{CCAS} and
diff --git a/lib/am/compile.am b/lib/am/compile.am
index 6e515e5..3be6f7d 100644
--- a/lib/am/compile.am
+++ b/lib/am/compile.am
@@ -15,8 +15,8 @@
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 if %?STDINC%
-DEFAULT_INCLUDES = \
-  $(call am__memoize,DEFAULT_INCLUDES,$(strip \
+AM_DEFAULT_INCLUDES = \
+  $(call am__memoize,AM_DEFAULT_INCLUDES,$(strip \
 ## We want '-I. -I$(srcdir)', but the latter -I is redundant and
 ## unaesthetic in non-VPATH builds, so get rid of it if it is not
 ## actually needed.
@@ -24,7 +24,7 @@ DEFAULT_INCLUDES = \
       $(foreach am__h, $(AM_CONFIG_HEADERS), \
         $(patsubst %/,%,-I$(dir $(am__h)))))))
 else !%?STDINC%
-DEFAULT_INCLUDES =
+AM_DEFAULT_INCLUDES =
 endif !%?STDINC%
 
 mostlyclean-am: mostlyclean-compile
diff --git a/syntax-checks.mk b/syntax-checks.mk
index dd8d00b..2f5be71 100644
--- a/syntax-checks.mk
+++ b/syntax-checks.mk
@@ -325,6 +325,7 @@ modern.am__TEST_BASES = am__test_bases
 modern.am__TEST_LOGS = am__test_logs
 modern.am__TEST_RESULTS = am__test_results
 modern.CONFIG_HEADER = AM_CONFIG_HEADERS
+modern.DEFAULT_INCLUDES = AM_DEFAULT_INCLUDES
 
 Sc_renamed_variables_rules = \
   $(patsubst modern.%,sc_no_%,$(filter modern.%,$(.VARIABLES)))
diff --git a/t/confh4.sh b/t/confh4.sh
index a87b38e..ddcbeba 100755
--- a/t/confh4.sh
+++ b/t/confh4.sh
@@ -37,7 +37,7 @@ mkdir include sub
 : > include/config.h.in
 
 cat > c-defs.am << 'END'
-## To bring in the definition of DEFAULT_INCLUDES
+## To bring in the definition of AM_DEFAULT_INCLUDES
 CC = who-cares
 AUTOMAKE_OPTIONS = no-dependencies
 bin_PROGRAMS = foo
@@ -47,7 +47,7 @@ cat > Makefile.am << 'END'
 include $(top_srcdir)/c-defs.am
 .PHONY: test-default-includes
 test-default-includes:
-       echo ' ' $(DEFAULT_INCLUDES) ' ' \
+       echo ' ' $(AM_DEFAULT_INCLUDES) ' ' \
          | $(FGREP) ' -I$(top_builddir)/include '
 END
 
@@ -57,8 +57,8 @@ cat > include/Makefile.am << 'END'
 include $(top_srcdir)/c-defs.am
 .PHONY: test-default-includes
 test-default-includes:
-       echo ' ' $(DEFAULT_INCLUDES) ' ' | $(FGREP) ' -I. '
-       case ' $(DEFAULT_INCLUDES) ' in \
+       echo ' ' $(AM_DEFAULT_INCLUDES) ' ' | $(FGREP) ' -I. '
+       case ' $(AM_DEFAULT_INCLUDES) ' in \
          *'$(top_builddir)'*) exit 1;; \
          *include*) exit 1;; \
          *-I.*-I.*) exit 1;; \
diff --git a/t/no-extra-makefile-code.sh b/t/no-extra-makefile-code.sh
index f0246b7..1c91452 100755
--- a/t/no-extra-makefile-code.sh
+++ b/t/no-extra-makefile-code.sh
@@ -30,7 +30,6 @@ rm -f depcomp compile
 $ACLOCAL
 $AUTOMAKE
 
-$EGREP 'DEFAULT_INCLUDES|-compile|\$\(OBJEXT\)|tab\.[ch]' Makefile.in \
-  && Exit 1
+$EGREP 'INCLUDE|-compile|\$\(OBJEXT\)|tab\.[ch]' Makefile.in && Exit 1
 
 :
-- 
1.7.9.5




reply via email to

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