From: Ralf Wildenhues Date: Mon, 9 Mar 2009 20:57:49 +0000 (+0100) Subject: Provide variables for silencing of user rules. X-Git-Tag: v1.10b~7^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bee1af31a3e62086b4476ad491aacfecb4e149d8;p=thirdparty%2Fautomake.git 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. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 97a9f2fad..fdb36483f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2009-03-09 Ralf Wildenhues + 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 diff --git a/automake.in b/automake.in index 9757ed783..7286a4452 100755 --- a/automake.in +++ b/automake.in @@ -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'); } diff --git a/doc/automake.texi b/doc/automake.texi index da6e779f3..2a22ca468 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -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} diff --git a/tests/Makefile.am b/tests/Makefile.am index a1af65d6d..2197a110f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -542,6 +542,7 @@ silent3.test \ silent4.test \ silent5.test \ silent6.test \ +silent7.test \ sinclude.test \ srcsub.test \ srcsub2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 04b6582a2..ddd73bd06 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..4fd52f323 --- /dev/null +++ b/tests/silent7.test @@ -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 . + +# 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 + +: