automake-patches
[Top][All Lists]
Advanced

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

[PATCH 4/4] New automake command line option `--silent-rules'.


From: Ralf Wildenhues
Subject: [PATCH 4/4] New automake command line option `--silent-rules'.
Date: Sun, 8 Mar 2009 10:46:40 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

For this patch, I'm unsure if we should even add it at all.
It adds an automake option to enable silent build rules.
Here's why I wrote it in the first place: if you are a distribution
and want to change all your packages to build silently, you may not
want to change each package's configure.ac file.  So instead you
could change $AUTOMAKE to contain this flag.

Do you think this is worthwhile to even have?  If not, I will probably
want to leave it out for 1.11.

The current patch still has a couple of warts in that --silent-rules
should turn off portability-recursive warnings independently of the
command line argument order.  This is another reason I don't like this
addition much: it needs more special-casing and complex semantics in
order to work seamlessly for users.

The silent6.test should be retained, though, I guess, or redone with
extensions for users documented.

Cheers,
Ralf

    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.

diff --git a/NEWS b/NEWS
index 78ce7ab..6975751 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 94454c2..675a1fe 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 0d104cc..da6e779 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.
 
address@hidden --silent-rules
address@hidden --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 5ff30e4..9b66bff 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 dfc01de..42a149f 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 3c43a61..5b79eb0 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 99c03da..63078bb 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 0000000..2bc2f8f
--- /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 <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
+
+:




reply via email to

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