From f04bfdf3e333e1ba15ab9ad02355aad503c28e48 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sat, 7 Mar 2009 16:01:34 +0100 Subject: [PATCH] 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. Signed-off-by: Ralf Wildenhues --- ChangeLog | 12 +++++++ NEWS | 2 ++ automake.in | 8 ++++- doc/automake.texi | 4 +++ tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/dollarvar.test | 9 ++++++ tests/pr300-ltlib.test | 4 +-- tests/silent6.test | 73 ++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 111 insertions(+), 3 deletions(-) create mode 100755 tests/silent6.test diff --git a/ChangeLog b/ChangeLog index cd4c9fd01..888368fbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2009-03-07 Ralf Wildenhues + 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 78ce7ab86..697575104 100644 --- 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. diff --git a/automake.in b/automake.in index 94454c2ac..675a1fe9c 100755 --- a/automake.in +++ b/automake.in @@ -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] =~ /^-./) diff --git a/doc/automake.texi b/doc/automake.texi index 0d104ccf8..da6e779f3 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -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 diff --git a/tests/Makefile.am b/tests/Makefile.am index 5ff30e4e5..9b66bff9e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -540,6 +540,7 @@ silent2.test \ silent3.test \ silent4.test \ silent5.test \ +silent6.test \ sinclude.test \ srcsub.test \ srcsub2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index dfc01de0b..42a149f96 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -695,6 +695,7 @@ silent2.test \ silent3.test \ silent4.test \ silent5.test \ +silent6.test \ sinclude.test \ srcsub.test \ srcsub2.test \ diff --git a/tests/dollarvar.test b/tests/dollarvar.test index 3c43a61b7..5b79eb0d4 100755 --- a/tests/dollarvar.test +++ b/tests/dollarvar.test @@ -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 diff --git a/tests/pr300-ltlib.test b/tests/pr300-ltlib.test index 99c03da2a..63078bbcf 100755 --- a/tests/pr300-ltlib.test +++ b/tests/pr300-ltlib.test @@ -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 index 000000000..2bc2f8fb8 --- /dev/null +++ b/tests/silent6.test @@ -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 . + +# 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 + +: -- 2.47.2