]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Provide variables for silencing of user rules.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 9 Mar 2009 20:57:49 +0000 (21:57 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 9 Mar 2009 20:57:49 +0000 (21:57 +0100)
* automake.in (handle_languages): Always define `AM_V_GEN' and
`AM_V_at'.
* doc/automake.texi (Options): Document these flags.
* tests/silent7.test: New test.
* tests/Makefile.am: Update.

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

index 97a9f2fadd0caa6e36bcde175b2ea7b0e85c0179..fdb36483f4cb3799cef95e5c9c646ded4a2a5df4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-03-09  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Provide variables for silencing of user rules.
+       * automake.in (handle_languages): Always define `AM_V_GEN' and
+       `AM_V_at'.
+       * doc/automake.texi (Options): Document these flags.
+       * tests/silent7.test: New test.
+       * tests/Makefile.am: Update.
+
        Redo variable naming for `silent' machinery.
        The public variables are named `AM_V_' plus the compiler
        short-hand now, e.g.: AM_V_CC, AM_V_CXXLD, AM_V_GEN.  The
index 9757ed7836245fad1531c92ee52cecac0eb3462f..7286a445281c723975cd10a1fe69196cfbb82344 100755 (executable)
@@ -1649,6 +1649,9 @@ sub handle_languages
          unless defined $done{$languages{'c'}};
        define_linker_variable ($languages{'c'});
       }
+
+    # Always provide the user with `AM_V_GEN' for `silent' mode.
+    define_verbose_tagvar ('GEN');
 }
 
 
index da6e779f387f2df3aaa112a3bea4cb2457fb5abb..2a22ca4680c72efce328184800ef583f57bc7f4c 100644 (file)
@@ -8733,6 +8733,14 @@ variable expansion @samp{$(@var{var1}$(V))}.  Do not use the
 expansion, which are in turn enabled by @option{-Wportability}
 (@pxref{Invoking Automake}).
 
+@vindex @code{AM_V_GEN}
+@vindex @code{AM_V_at}
+To extend the silent mode to your own rules, you can use the predefined
+variable @code{AM_V_GEN} as a prefix to commands that should output a
+status line in silent mode, and @code{AM_V_at} as a prefix to commands
+that should not output anything in silent mode.  With @code{V=1}, these
+variables will expand to empty strings.
+
 @item @option{std-options}
 @cindex Options, @option{std-options}
 @cindex @samp{make installcheck}, testing @option{--help} and @option{--version}
index a1af65d6d0190d6460c54c53038b8dba7f255dbc..2197a110f90ab98d33615ec63a05637fbf8cfe55 100644 (file)
@@ -542,6 +542,7 @@ silent3.test \
 silent4.test \
 silent5.test \
 silent6.test \
+silent7.test \
 sinclude.test \
 srcsub.test \
 srcsub2.test \
index 04b6582a29a445f4c354694950270f5903ae2141..ddd73bd06549e38fb66613b2532dfe9602bf9a41 100644 (file)
@@ -697,6 +697,7 @@ silent3.test \
 silent4.test \
 silent5.test \
 silent6.test \
+silent7.test \
 sinclude.test \
 srcsub.test \
 srcsub2.test \
diff --git a/tests/silent7.test b/tests/silent7.test
new file mode 100755 (executable)
index 0000000..4fd52f3
--- /dev/null
@@ -0,0 +1,71 @@
+#!/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'
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+all-local: foo
+
+## And here's how you should do it in your own code:
+foo: foo.in
+       $(AM_V_GEN)cp $(srcdir)/foo.in $@
+       $(AM_V_at)echo more >> $@
+
+EXTRA_DIST = foo.in
+CLEANFILES = foo
+EOF
+
+: >foo.in
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'GEN.*foo' stdout && Exit 1
+grep 'cp ' stdout
+grep 'echo ' stdout
+
+$MAKE distclean
+
+echo 'AUTOMAKE_OPTIONS = silent' >> Makefile.am
+$AUTOMAKE
+
+./configure
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'GEN.*foo' stdout
+grep 'cp ' stdout && Exit 1
+grep 'echo ' stdout && Exit 1
+
+$MAKE clean
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'GEN.*foo' stdout && Exit 1
+grep 'cp ' stdout
+grep 'echo ' stdout
+
+: