New automake command line option `--silent-rules'.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 7 Mar 2009 15:01:34 +0000 (16:01 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 7 Mar 2009 15:03:34 +0000 (16:03 +0100)
* automake.in (parse_arguments): Accept `--silent-rules; let it
override command line warning settings.
(usage): Document it.
* doc/automake.texi (Invoking Automake): Document it.
* NEWS: Update.
* tests/dollarvar.test: Also test `--silent-rules'.
* tests/pr300-ltlib.test: Use `$MAKE V=1' to enable verbose
output, which is matched later in the test.
* tests/silent6.test: New test.
* tests/Makefile.am: Update.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
automake.in
doc/automake.texi
tests/Makefile.am
tests/Makefile.in
tests/dollarvar.test
tests/pr300-ltlib.test
tests/silent6.test [new file with mode: 0755]

index cd4c9fd..888368f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2009-03-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       New automake command line option `--silent-rules'.
+       * automake.in (parse_arguments): Accept `--silent-rules; let it
+       override command line warning settings.
+       (usage): Document it.
+       * doc/automake.texi (Invoking Automake): Document it.
+       * NEWS: Update.
+       * tests/dollarvar.test: Also test `--silent-rules'.
+       * tests/pr300-ltlib.test: Use `$MAKE V=1' to enable verbose
+       output, which is matched later in the test.
+       * tests/silent6.test: New test.
+       * tests/Makefile.am: Update.
+
        Documentation and tests for the `silent' option.
        * NEWS: Update.
        * doc/automake.texi (Invoking Automake): `silent' turns off some
diff --git a/NEWS b/NEWS
index 78ce7ab..6975751 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -113,6 +113,8 @@ New in 1.10a:
     This option requires the widely supported but non-POSIX `make' feature
     of recursive variable expansion, so do not use it if your package needs
     to build with `make' implementations that do not support it.
+    Besides the normal option setting methods, it can also be enabled
+    globally by the new automake option `--silent-rules'.
 
   - New prefix `notrans_' for manpages which should not be transformed
     by --program-transform.
index 94454c2..675a1fe 100755 (executable)
@@ -8039,6 +8039,7 @@ Flavors:
       --foreign          set strictness to foreign
       --gnits            set strictness to gnits
       --gnu              set strictness to gnu
+      --silent-rules     enable silent build rules
 
 Library files:
   -a, --add-missing      add missing standard files to package
@@ -8144,7 +8145,8 @@ sub parse_arguments ()
      'f|force-missing'  => \$force_missing,
      'o|output-dir=s'  => \$output_directory,
      'a|add-missing'   => \$add_missing,
-     'c|copy'          => \$copy_missing,
+     'c|copy'          => \$copy_missing,
+     'silent-rules'    => sub { set_global_option ('silent', $cli_where); },
      'v|verbose'       => sub { setup_channel 'verb', silent => 0; },
      'W|warnings=s'     => \&parse_warnings,
      # These long options (--Werror and --Wno-error) for backward
@@ -8189,6 +8191,10 @@ sub parse_arguments ()
       $output_directory = '.';
     }
 
+  # Override portability-recursive warning.
+  process_global_option_list ($cli_where, 'silent')
+    if global_option 'silent';
+
   return unless @ARGV;
 
   if ($ARGV[0] =~ /^-./)
index 0d104cc..da6e779 100644 (file)
@@ -2515,6 +2515,10 @@ Ordinarily each @file{Makefile.in} is created in the directory of the
 corresponding @file{Makefile.am}.  This option is deprecated and will be
 removed in a future release.
 
+@item --silent-rules
+@opindex --silent-rules
+Enable the @option{silent} option globally (@pxref{Options}).
+
 @item -v
 @itemx --verbose
 @opindex -v
index 5ff30e4..9b66bff 100644 (file)
@@ -540,6 +540,7 @@ silent2.test \
 silent3.test \
 silent4.test \
 silent5.test \
+silent6.test \
 sinclude.test \
 srcsub.test \
 srcsub2.test \
index dfc01de..42a149f 100644 (file)
@@ -695,6 +695,7 @@ silent2.test \
 silent3.test \
 silent4.test \
 silent5.test \
+silent6.test \
 sinclude.test \
 srcsub.test \
 srcsub2.test \
index 3c43a61..5b79eb0 100755 (executable)
@@ -48,6 +48,15 @@ grep 'Makefile.am:7' stderr
 # On the other hand, if we allow `silent' mode, then we need to allow
 # recursive variable expansion, too.
 
+# This should work with the `--silent-rules' command line switch.
+AUTOMAKE_fails -Wportability --silent-rules
+grep 'Makefile.am:2' stderr
+grep 'Makefile.am:3' stderr
+grep 'Makefile.am:4' stderr
+grep 'Makefile.am:5' stderr
+grep 'Makefile.am:6' stderr && Exit 1
+grep 'Makefile.am:7' stderr && Exit 1
+
 # This should work with AUTOMAKE_OPTIONS.
 echo 'AUTOMAKE_OPTIONS = silent' >> Makefile.am
 
index 99c03da..63078bb 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2007, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2007, 2008, 2009  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
@@ -48,7 +48,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --copy --add-missing
 ./configure --prefix "`pwd`/inst"
-$MAKE >stdout
+$MAKE V=1 >stdout
 cat stdout
 
 grep 'liba.la .*-rpath .*lib' stdout
diff --git a/tests/silent6.test b/tests/silent6.test
new file mode 100755 (executable)
index 0000000..2bc2f8f
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/sh
+# Copyright (C) 2009  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 3, 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 user extensibility of silent mode.
+
+. ./defs
+
+set -e
+
+cat >>configure.in <<'EOF'
+# Layering violation: this conditional should be decided
+# by the package author, not the user.  We just do it here
+# for testing convenience.
+AM_CONDITIONAL([SILENT], [test "$silent_rules" = yes])
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+if SILENT
+my_verbose = $(my_verbose_$V)
+my_verbose_ = $(my_verbose_0)
+my_verbose_0 = @echo GEN $@;
+endif
+
+all-local: foo
+
+foo: foo.in
+       $(my_verbose)cp $(srcdir)/foo.in $@
+EXTRA_DIST = foo.in
+CLEANFILES = foo
+EOF
+
+: >foo.in
+
+$ACLOCAL
+# FIXME: it should not be necessary to disable Wportability here.
+$AUTOMAKE --add-missing -Wno-portability --silent-rules
+$AUTOCONF
+
+./configure silent_rules=yes
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'GEN foo' stdout
+grep 'cp ' stdout && Exit 1
+
+$MAKE clean
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'GEN foo' stdout && Exit 1
+grep 'cp ' stdout
+
+$MAKE distclean
+
+./configure silent_rules=no
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'GEN foo' stdout && Exit 1
+grep 'cp ' stdout
+
+: