automake-ng
[Top][All Lists]
Advanced

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

[Automake-ng] [PATCH] [ng] silent: GNU make understands nested variable


From: Stefano Lattarini
Subject: [Automake-ng] [PATCH] [ng] silent: GNU make understands nested variable expansions
Date: Sun, 22 Jan 2012 17:00:24 +0100

So there's no need to check at configure time whether nested
variable expansion is supported.  That check that was introduced
in commit 'v1.11-598-g8493499' of 2011-12-25 ("silent-rules:
fallback for makes without nested vars) in response to automake
bugs #9928 and #10237.

This commit basically reverts patch 'v1.11-598-g8493499' and some
of its follow-ups.

* m4/silent.m4 (AM_SILENT_RULES): Don't check whether 'make'
supports nested variables; assume that unconditionally.  Don't
AC_SUBST '@AM_V@' nor '@AM_DEFAULT_V@' anymore.
* automake.in (define_verbose_var): Simplify accordingly.
* doc/automake.texi: Update.
* tests/silent-nested-vars.test: Remove as obsolete.
* tests/list-of-tests.mk: Update.
---

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

 automake.in                   |    8 +--
 doc/automake.texi             |   25 +++----
 m4/silent.m4                  |   34 +---------
 tests/list-of-tests.mk        |    1 -
 tests/silent-nested-vars.test |  149 -----------------------------------------
 5 files changed, 14 insertions(+), 203 deletions(-)
 delete mode 100755 tests/silent-nested-vars.test

diff --git a/automake.in b/automake.in
index 68518e5..27a9fb1 100644
--- a/automake.in
+++ b/automake.in
@@ -1140,12 +1140,8 @@ sub define_verbose_var ($$)
     my $silent_var = $pvar . '_0';
     if (option 'silent-rules')
       {
-       # For typical `make's, `configure' replaces AM_V (inside @@) with $(V)
-       # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY).
-       # For strict POSIX 2008 `make's, it replaces them with 0 or 1 instead.
-       # See AM_SILENT_RULES in m4/silent.m4.
-       define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL);
-       define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)', 
INTERNAL);
+       define_variable ($var, '$(' . $pvar . '_$(V))', INTERNAL);
+       define_variable ($pvar . '_', '$(' . $pvar . 
'_$(AM_DEFAULT_VERBOSITY))', INTERNAL);
        Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val,
                                    '', INTERNAL, VAR_ASIS)
          if (! vardef ($silent_var, TRUE));
diff --git a/doc/automake.texi b/doc/automake.texi
index 227a4eb..eb11254 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -10922,23 +10922,18 @@ For portability to different @command{make} 
implementations, package authors
 are advised to not set the variable @code{V} inside the @file{Makefile.am}
 file, to allow the user to override the value for subdirectories as well.
 
-The current implementation of this feature normally uses nested
-variable expansion @samp{$(@var{var1}$(V))}, a @file{Makefile} feature
-that is not required by POSIX 2008 but is widely supported in
-practice.  The @option{silent-rules} option thus turns off warnings
-about recursive variable expansion, which are in turn enabled by
address@hidden (@pxref{automake Invocation}).  On the rare
address@hidden implementations that do not support nested variable
-expansion, whether rules are silent is always determined at configure
-time, and cannot be overridden at make time.  Future versions of POSIX
-are likely to require nested variable expansion, so this minor
-limitation should go away with time.
+The current implementation of this feature relies on a non-POSIX, but in
+practice rather widely supported @file{Makefile} construct of nested
+variable expansion @samp{$(@var{var1}$(V))}.  Do not use the
address@hidden option if your package needs to build with
address@hidden implementations that do not support it.  The
address@hidden option turns off warnings about recursive variable
+expansion, which are in turn enabled by @option{-Wportability}
+(@pxref{automake Invocation}).
 
 @vindex @code{AM_V_GEN}
 @vindex @code{AM_V_at}
 @vindex @code{AM_DEFAULT_VERBOSITY}
address@hidden @code{AM_V}
address@hidden @code{AM_DEFAULT_V}
 To extend the silent mode to your own rules, you have two choices:
 
 @itemize @bullet
@@ -10954,8 +10949,8 @@ The following snippet shows how you would define your 
own equivalent of
 @code{AM_V_GEN}:
 
 @example
-pkg_verbose = $(pkg_verbose_@@AM_V@@)
-pkg_verbose_ = $(pkg_verbose_@@AM_DEFAULT_V@@)
+pkg_verbose = $(pkg_verbose_$(V))
+pkg_verbose_ = $(pkg_verbose_$(AM_DEFAULT_VERBOSITY))
 pkg_verbose_0 = @@echo PKG-GEN $@@;
 
 foo: foo.in
diff --git a/m4/silent.m4 b/m4/silent.m4
index c94fff9..f8d0b5a 100644
--- a/m4/silent.m4
+++ b/m4/silent.m4
@@ -1,11 +1,11 @@
 ##                                                          -*- Autoconf -*-
-# Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2009, 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 2
+# serial 1
 
 # AM_SILENT_RULES([DEFAULT])
 # --------------------------
@@ -25,36 +25,6 @@ case $enable_silent_rules in @%:@ (((
    no) AM_DEFAULT_VERBOSITY=1;;
     *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
 esac
-dnl
-dnl A few `make' implementations (e.g., NonStop OS and NextStep)
-dnl do not support nested variable expansions.
-dnl See automake bug#9928 and bug#10237.
-am_make=${MAKE-make}
-AC_CACHE_CHECK([whether $am_make supports nested variables],
-   [am_cv_make_support_nested_variables],
-   [if AS_ECHO([['TRUE=$(BAR$(V))
-BAR0=false
-BAR1=true
-V=1
-am__doit:
-       @$(TRUE)
-.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
-  am_cv_make_support_nested_variables=yes
-else
-  am_cv_make_support_nested_variables=no
-fi])
-if test $am_cv_make_support_nested_variables = yes; then
-  dnl Using `$V' instead of `$(V)' breaks IRIX make.
-  AM_V='$(V)'
-  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
-else
-  AM_V=$AM_DEFAULT_VERBOSITY
-  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
-fi
-AC_SUBST([AM_V])dnl
-AM_SUBST_NOTMAKE([AM_V])dnl
-AC_SUBST([AM_DEFAULT_V])dnl
-AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
 AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
 AM_BACKSLASH='\'
 AC_SUBST([AM_BACKSLASH])dnl
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 417e463..4d3b6bf 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -921,7 +921,6 @@ silent-yacc-gcc.test \
 silent-yacc-generic.test \
 silent-nowarn.test \
 silent-configsite.test \
-silent-nested-vars.test \
 srcsub.test \
 srcsub2.test \
 space.test \
diff --git a/tests/silent-nested-vars.test b/tests/silent-nested-vars.test
deleted file mode 100755
index 0024b5d..0000000
--- a/tests/silent-nested-vars.test
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/bin/sh
-# Copyright (C) 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/>.
-
-# Check silent-rules mode, on 'make' implementations that do not
-# support nested variables (Bug#9928, Bug#10237).
-
-. ./defs || Exit 1
-
-set -e
-
-cat >>configure.in <<'EOF'
-AM_SILENT_RULES
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_OUTPUT
-EOF
-
-cat > Makefile.am <<'EOF'
-# Need generic and non-generic rules.
-bin_PROGRAMS = foo bar
-bar_CFLAGS = $(AM_CFLAGS)
-
-# Check that AM_V and AM_DEFAULT_V work as advertised.
-pkg_verbose = $(address@hidden@)
-pkg_verbose_ = $(address@hidden@)
-pkg_verbose_0 = @echo PKG-GEN $@;
-
-bin_SCRIPTS = oop
-oop:
-       $(pkg_verbose)echo $@ >$@
-
-mostlyclean-local:
-       rm -f oop
-EOF
-
-cat > foo.c <<'EOF'
-int main ()
-{
-  return 0;
-}
-EOF
-cp foo.c bar.c
-
-cat >mymake <<'EOF'
-#! /bin/sh
-makerules=
-
-case $1 in
-  -f)
-    makefile=$2
-    case $2 in
-      -) makerules=`cat` || exit ;;
-    esac ;;
-  *)
-    for makefile in makefile Makefile; do
-      test -f $makefile && break
-    done ;;
-esac
-
-nested_var_pat='^[^#].*\$([^)]*\$'
-if
-  case $makefile in
-    -) printf '%s\n' "$makerules" | grep "$nested_var_pat";;
-    *) grep "$nested_var_pat" $makefile;;
-  esac
-then
-  echo >&2 "mymake: $makefile contains nested variables"
-  exit 1
-fi
-
-case $makefile in
-  -) printf '%s\n' "$makerules" | $mymake_MAKE "$@";;
-  *) exec $mymake_MAKE "$@";;
-esac
-EOF
-chmod a+x mymake
-mymake_MAKE=${MAKE-make}
-MAKE=./mymake
-export MAKE mymake_MAKE
-
-# As a sanity check, verify that `mymake' rejects Makefiles that
-# use nested variables.
-cat > Makefile <<'END'
-a = $(b$(c))
-all:
-       touch bar
-END
-$MAKE && Exit 99
-mv -f Makefile foo.mk
-$MAKE -f foo.mk && Exit 99
-cat foo.mk | $MAKE -f - && Exit 99
-test -f bar && Exit 99
-sed '/a =/d' foo.mk > Makefile
-$MAKE && test -f bar || Exit 99
-rm -f bar Makefile foo.mk
-
-$ACLOCAL
-$AUTOMAKE --add-missing
-$AUTOCONF
-
-./configure --enable-silent-rules >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^checking whether \./mymake supports nested variables\.\.\. no *$' \
-  stdout
-$EGREP 'CC|AM_V|GEN' Makefile # For debugging.
-grep '^AM_V_CC =  *\$(am__v_CC_0) *$' Makefile
-grep '^AM_V_GEN =  *\$(am__v_GEN_0) *$' Makefile
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-$EGREP ' (-c|-o)' stdout && Exit 1
-grep 'mv ' stdout && Exit 1
-grep 'echo .*oop' stdout && Exit 1
-grep 'CC .*foo\.' stdout
-grep 'CC .*bar\.' stdout
-grep 'CCLD .*foo' stdout
-grep 'CCLD .*bar' stdout
-grep 'PKG-GEN .*oop' stdout
-$MAKE distclean
-
-./configure --disable-silent-rules > stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^checking whether \./mymake supports nested variables\.\.\. no *$' \
-  stdout
-$EGREP 'CC|AM_V|GEN' Makefile # For debugging.
-grep '^AM_V_CC =  *\$(am__v_CC_1) *$' Makefile
-grep '^AM_V_GEN =  *\$(am__v_GEN_1) *$' Makefile
-
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep ' -c' stdout
-grep ' -o foo' stdout
-grep ' -o bar' stdout
-grep 'echo .*>oop' stdout
-$EGREP '(CC|LD) ' stdout && Exit 1
-
-:
-- 
1.7.7.3




reply via email to

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