automake-ng
[Top][All Lists]
Advanced

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

[Automake-ng] [PATCH] [ng] deptrack: GNU make always supports the 'inclu


From: Stefano Lattarini
Subject: [Automake-ng] [PATCH] [ng] deptrack: GNU make always supports the 'include' directive
Date: Sun, 22 Jan 2012 17:10:05 +0100

Now that we assume GNU make, there is no need to check whether
and how the target make program supports an "include" directive.
In particular, the AC_SUBST'd variables 'am__include' and
'am__quote', as well as the autoconf macro 'AM_MAKE_INCLUDE',
are redundant, and shouldn't be used anymore.

* m4/make.m4: Delete, it's not needed anymore.  In particular,
this removes the definition of ...
(AM_MAKE_INCLUDE): ... this internal macro.
* m4/depend.m4 (_AM_DEPENDENCIES): Assume make can always include
files at runtime with the "include FILE" syntax.  Don't require
the 'AM_MAKE_INCLUDE' macro anymore.
* m4/depout.m4 (_AM_OUTPUT_DEPENDENCY_COMMANDS): We don't need to
extract the definition of 'am__include' and 'am__quote' from the
makefile anymore; simplify accordingly.
* m4/Makefile.am (dist_automake_ac_DATA): Remove it.
* doc/automake.texi (Private Macros): Remove mention of the
obsolete macro 'AM_MAKE_INCLUDE'.
* Makefile.am (sc_make_simple_include): New maintainer check.
(sc_tests_make_simple_include): Likewise.
(syntax_check_rules): Add them.
(sc_grep_for_bad_make_include): New helper variable used by the
two new checks.
* tests/make.test: Remove, it's obsolete.
* tests/subobj11b.test: Likewise.
* tests/list-of-tests.mk: Don't list the deleted tests.
* tests/exsource.test: Update.
* tests/depend.test: Likewise.
* tests/depend4.test: Likewise.
* tests/subobj11a.test: Likewise.
* tests/subobj11c.test: Likewise.
---

I will push this in 72 hours if there is no review by then.

 Makefile.am            |   24 +++++++++++++
 automake.in            |    8 +----
 doc/automake.texi      |    5 ---
 m4/Makefile.am         |    1 -
 m4/depend.m4           |    7 ++--
 m4/depout.m4           |   16 +++------
 m4/make.m4             |   51 ----------------------------
 tests/depend.test      |    8 +++--
 tests/depend4.test     |    5 ++-
 tests/exsource.test    |    8 +++--
 tests/list-of-tests.mk |    2 -
 tests/make.test        |   51 ----------------------------
 tests/subobj11a.test   |   16 ++++++---
 tests/subobj11b.test   |   85 ------------------------------------------------
 tests/subobj11c.test   |    6 ++--
 15 files changed, 61 insertions(+), 232 deletions(-)
 delete mode 100644 m4/make.m4
 delete mode 100755 tests/make.test
 delete mode 100755 tests/subobj11b.test

diff --git a/Makefile.am b/Makefile.am
index c88b2da..bb40e37 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -235,6 +235,8 @@ sc_tests_make_can_chain_suffix_rules \
 sc_no_am_makeflags \
 sc_tests_no_make_e \
 sc_docs_no_make_e \
+sc_make_simple_include \
+sc_tests_make_simple_include \
 sc_tests_obsolete_variables \
 sc_tests_plain_make \
 sc_tests_plain_autoconf \
@@ -501,6 +503,28 @@ sc_tests_make_can_chain_suffix_rules:
          exit 1; \
        fi
 
+## GNU make supports POSIX-style runtime include directives.
+sc_grep_for_bad_make_include = \
+  if grep -E 'AM_MAKE_INCLUDE|am__(include|quote)' $$files; then \
+    echo 'GNU make supports runtime "include" directive.' 1>&2; \
+    echo 'Neither am__{include,quote} nor AM_MAKE_INCLUDE' \
+         'should be used anymore.' 1>&2; \
+    exit 1; \
+  fi
+sc_tests_make_simple_include: sc_ensure_testsuite_has_run
+       @files=tests/*.log; $(sc_grep_for_bad_make_include)
+sc_make_simple_include:
+       @files=" \
+          $(xtests) \
+          $(srcdir)/lib/am/*.am \
+          $(srcdir)/m4/*.m4 \
+          $(srcdir)/automake.in \
+          $(srcdir)/doc/*.texi \
+          aclocal.m4 \
+          configure \
+        "; \
+        $(sc_grep_for_bad_make_include)
+
 ## $(AM_MAKEFLAGS) is obsolete now that we assume GNU make, since it
 ## is smart enough to correctly pass the values of macros redefined on
 ## the command line to sub-make invocations.
diff --git a/automake.in b/automake.in
index 68518e5..53f1127 100644
--- a/automake.in
+++ b/automake.in
@@ -1323,13 +1323,7 @@ sub handle_languages
            $output_rules .= "\n";
            foreach my $iter (@deplist)
            {
-               $output_rules .= (subst ('AMDEP_TRUE')
-                                 . subst ('am__include')
-                                 . ' '
-                                 . subst ('am__quote')
-                                 . $iter
-                                 . subst ('am__quote')
-                                 . "\n");
+               $output_rules .= subst ('AMDEP_TRUE') . "include $iter\n";
            }
 
            # Compute the set of directories to remove in distclean-depend.
diff --git a/doc/automake.texi b/doc/automake.texi
index 227a4eb..a8a7e38 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -4189,11 +4189,6 @@ These macros are used to implement Automake's automatic 
dependency
 tracking scheme.  They are called automatically by Automake when
 required, and there should be no need to invoke them manually.
 
address@hidden AM_MAKE_INCLUDE
-This macro is used to discover how the user's @command{make} handles
address@hidden statements.  This macro is automatically invoked when
-needed; there should be no need to invoke it manually.
-
 @item AM_PROG_INSTALL_STRIP
 This is used to find a version of @code{install} that can be used to
 strip a program at installation time.  This macro is automatically
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 95cb44d..3608511 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -37,7 +37,6 @@ lead-dot.m4 \
 lex.m4 \
 lispdir.m4 \
 maintainer.m4 \
-make.m4 \
 minuso.m4 \
 missing.m4 \
 mkdirp.m4 \
diff --git a/m4/depend.m4 b/m4/depend.m4
index cf1b3d8..be9c511 100644
--- a/m4/depend.m4
+++ b/m4/depend.m4
@@ -1,12 +1,12 @@
 ##                                                          -*- Autoconf -*-
 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# 2010, 2011, 2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 14
+# serial 15
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -28,7 +28,6 @@
 AC_DEFUN([_AM_DEPENDENCIES],
 [AC_REQUIRE([AM_SET_DEPDIR])dnl
 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
-AC_REQUIRE([AM_MAKE_INCLUDE])dnl
 AC_REQUIRE([AM_DEP_TRACK])dnl
 
 m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
@@ -89,7 +88,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
       # Solaris 8's {/usr,}/bin/sh.
       touch sub/conftst$i.h
     done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+    echo "include sub/conftest.Po" > confmf
 
     # We check with `-c' and `-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
diff --git a/m4/depout.m4 b/m4/depout.m4
index 3e046cd..81d8174 100644
--- a/m4/depout.m4
+++ b/m4/depout.m4
@@ -1,13 +1,13 @@
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2012
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 5
+#serial 6
 
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
@@ -37,20 +37,16 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
     else
       continue
     fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
+    # Extract the definition of DEPDIR from the Makefile without
+    # running `make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+    for file in `sed -n 's/^include \(.*(DEPDIR).*\)$/\1/p' <"$mf" \
+                 | sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`AS_DIRNAME(["$file"])`
diff --git a/m4/make.m4 b/m4/make.m4
deleted file mode 100644
index 68d15b9..0000000
--- a/m4/make.m4
+++ /dev/null
@@ -1,51 +0,0 @@
-# Check to see how 'make' treats includes.                 -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-# AM_MAKE_INCLUDE()
-# -----------------
-# Check to see how make treats includes.
-AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-       @echo this is the am__doit target
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
diff --git a/tests/depend.test b/tests/depend.test
index 98b1307..5a5e950 100755
--- a/tests/depend.test
+++ b/tests/depend.test
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1999, 2001, 2002, 2004, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2001, 2002, 2004, 2011, 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
@@ -32,4 +32,6 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-test 1 = `grep 'address@hidden@@am__include@' Makefile.in | wc -l`
+test 1 = `grep 'address@hidden@include ' Makefile.in | wc -l`
+
+:
diff --git a/tests/depend4.test b/tests/depend4.test
index 1dd782d..535faf7 100755
--- a/tests/depend4.test
+++ b/tests/depend4.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 2011, 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
@@ -30,7 +31,7 @@ for header in one.h two.h three.h four.h five.h six.h; do
     fred_SOURCES = fred1.c $headers
 END
   $AUTOMAKE
-  test 1 = `grep 'address@hidden@@am__include@' Makefile.in | wc -l`
+  test 1 = `grep 'address@hidden@include ' Makefile.in | wc -l`
 done
 
 :
diff --git a/tests/exsource.test b/tests/exsource.test
index daa5b01..194ce1f 100755
--- a/tests/exsource.test
+++ b/tests/exsource.test
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2004, 2011 Free
-# Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2004, 2011, 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
@@ -35,4 +35,6 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-grep '@am__include@ .*/xtra\.P' Makefile.in
+grep 'address@hidden@include .*/xtra\.P' Makefile.in
+
+:
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 417e463..a2bfab1 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -605,7 +605,6 @@ m4-inclusion.test \
 maintclean.test \
 maintclean-vpath.test \
 maintmode-configure-msg.test \
-make.test \
 makefile-deps.test \
 makej.test \
 makej2.test \
@@ -972,7 +971,6 @@ subobj8.test \
 subobj9.test \
 subobj10.test \
 subobj11a.test \
-subobj11b.test \
 subobj11c.test \
 subobjname.test \
 subpkg.test \
diff --git a/tests/make.test b/tests/make.test
deleted file mode 100755
index 651e805..0000000
--- a/tests/make.test
+++ /dev/null
@@ -1,51 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001, 2002, 2010, 2011 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/>.
-
-# Test to make sure `make' check works.
-# From Ralf Corsepius.
-
-. ./defs || Exit 1
-
-cat >> configure.in << 'END'
-AM_MAKE_INCLUDE
-AC_OUTPUT
-END
-
-: > Makefile.am
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-export ACLOCAL
-export AUTOCONF
-export AUTOMAKE
-
-# Do the test twice -- once with make and once with make -w.
-# This tests for a bug reported by Rainer Orth (see PR 175).
-
-save="$MAKE"
-for flag in '' -w; do
-   MAKE="$save $flag" ./configure
-   $FGREP 'am__include = include' Makefile
-   $sleep
-   touch configure.in
-   $MAKE $flag
-   $FGREP 'am__include = include' Makefile
-   rm -f config.cache
-done
-
-Exit 0
diff --git a/tests/subobj11a.test b/tests/subobj11a.test
index 80406e3..6ec938e 100755
--- a/tests/subobj11a.test
+++ b/tests/subobj11a.test
@@ -14,14 +14,20 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test that automake works around a bug of Solaris Make. The bug is the
-# following.  If we have a Makefile containg a file inclusion like this:
+# If we have a Makefile containing a file inclusion like this:
+#
 #   include .//foo.mk
-# Solaris make fails with a message like:
+#
+# Solaris 10 make fails with a message like:
+#
 #   make: ... can't find `/foo.mk': No such file or directory
 #   make: fatal error ... read of include file `/foo.mk' failed
-# (even if the file `foo.mk' exists). The error disappear by collapsing
-# the repeated slash `/' characters into a single one.
+#
+# (even if the file `foo.mk' exists). The error disappear by
+# collapsing the repeated slash `/' characters into a single one.
+#
+# GNU make shouldn't suffer from this bug; but we check for it
+# anyway -- better safe than sorry.
 #
 # See also sister "grepping" test `subobj11b.test', and related test
 # `subobj11c.test'.
diff --git a/tests/subobj11b.test b/tests/subobj11b.test
deleted file mode 100755
index 275b2ca..0000000
--- a/tests/subobj11b.test
+++ /dev/null
@@ -1,85 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2010, 2011 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/>.
-
-# Test that automake works around a bug of Solaris Make. The bug is the
-# following.  If we have a Makefile containg a file inclusion like this:
-#   include .//foo.mk
-# Solaris make fails with a message like:
-#   make: ... can't find `/foo.mk': No such file or directory
-#   make: fatal error ... read of include file `/foo.mk' failed
-# (even if the file `foo.mk' exists). The error disappear by collapsing
-# the repeated slash `/' characters into a single one.
-#
-# See also "semantic" sister test `subobj11a.test', and related test
-# `subobj11c.test'.
-
-. ./defs || Exit 1
-
-cat >> configure.in << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-END
-
-cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
-bin_PROGRAMS = foo
-## The `zardoz' sources should activate a code paths in Automake that
-## cannot be sensibly tested by sister test `subobj11a.test'.  The other
-## sources provide some sort of stress testing.
-foo_SOURCES = \
-  //server/zardoz0.c \
-  //server//zardoz1.c \
-  //server/path/to/zardoz2.c \
-  //server/another//path///to////zardoz3.c \
-  /foobar0.c \
-  ///foobar1.c \
-  ////foobar2.c \
-  /sub///foobar3.c \
-  ///sub/foobar4.c \
-  .//foobar5.c \
-  .//sub/foobar6.c \
-  ./sub//foobar7.c \
-  .//sub//foobar8.c \
-  sub/sub//sub///sub////foobar9.c
-END
-
-$ACLOCAL
-$AUTOMAKE -a
-
-# Be lax in the regexp, to account for automake conditionals, the
-# use of @am__include@, and similar stuff.
-grep 'include.*//.*foobar' Makefile.in && Exit 1
-
-# These checks depend on automake internals, but presently this is
-# the only way to test the code path we are interested in.
-# Please update these checks when (and if) the relevant automake
-# internals are changed.
-for x in zardoz0 zardoz1 path/to/zardoz2 another/path/to/zardoz3; do
-  case $x in
-   */*) d=`echo $x | sed 's,[^/]*$,,'`; b=`echo $x | sed 's,^.*/,,'`;;
-     *) d=''; b=$x;;
-  esac
-  # Be a little lax in the regexp, to account for automake conditionals,
-  # quoting, and similar stuff.
-  grep "^[^/]*am__include[^/]*//server/$d\\\$(DEPDIR)/$b\\.[^/]*$" Makefile.in
-done
-
-# Sanity checks.
-for i in 0 1 2 3 4 5 6 7 8 9; do
-  grep "am__include.*/foobar$i\\." Makefile.in
-done
-
-:
diff --git a/tests/subobj11c.test b/tests/subobj11c.test
index 6e8d270..d0f622b 100755
--- a/tests/subobj11c.test
+++ b/tests/subobj11c.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2010, 2011, 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
@@ -17,7 +17,7 @@
 # Automatic dependency tracking with subdir-objects option active:
 # check for a pathological case of slash-collapsing in the name of
 # included makefile fragments (containing dependency info).
-# See also related tests `subobj11a.test' and `subobj11b.test'.
+# See also related test `subobj11a.test'.
 
 . ./defs || Exit 1
 
@@ -46,6 +46,6 @@ $AUTOMAKE -a
 #
 # FIXME: Are we sure this is the most sensible output in our situation?
 #
-grep '^[^/]*am__include[^/]*//\$(DEPDIR)/zardoz\.[^/]*$' Makefile.in
+grep 'address@hidden@include [^/]*//\$(DEPDIR)/zardoz\.[^/]*$' Makefile.in
 
 :
-- 
1.7.7.3




reply via email to

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