Package: automake;
Reported by: "Daniel Richard G." <skunk <at> iSKUNK.ORG>
Date: Tue, 1 Nov 2011 04:40:02 UTC
Severity: minor
Tags: patch
Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9928 in the body.
You can then email your comments to 9928 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Tue, 01 Nov 2011 04:40:02 GMT) Full text and rfc822 format available."Daniel Richard G." <skunk <at> iSKUNK.ORG>
:bug-automake <at> gnu.org
.
(Tue, 01 Nov 2011 04:40:03 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Daniel Richard G." <skunk <at> iSKUNK.ORG> To: bug-automake <at> gnu.org Subject: AM_SILENT_RULES breakage with old make(1) Date: Tue, 01 Nov 2011 00:37:23 -0400
Hello list, I've recently encountered some breakage in building a package with Automake 1.11.1's new silent-rules feature enabled, on a VM install of NeXTSTEP 3.3. An example: $ make make all-am )) source='../pcre_compile.c' object='pcre_compile.lo' libtool=yes DEPDIR=.deps depmode=none /usr/local/bin/bash ../depcomp /usr/local/bin/bash ./libtool )) --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -O2 -c -o pcre_compile.lo ../pcre_compile.c sh: syntax error at line 1: `)' unexpected *** Exit 2 Stop. *** Exit 1 Stop. I tracked this down to the variable-variable-name constructs used to implement silent rules; this old version of make(1) doesn't parse them correctly. I added the line echo "AM_V_CC = '$(AM_V_CC)'" # for automake debugging to the .c.lo rule to see what was going on: $ make make all-am echo "AM_V_CC = '))'" # for automake debugging AM_V_CC = '))' )) source='../pcre_compile.c' object='pcre_compile.lo' libtool=yes DEPDIR=.deps depmode=none /usr/local/bin/bash ../depcomp /usr/local/bin/bash ./libtool )) --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -O2 -c -o pcre_compile.lo ../pcre_compile.c sh: syntax error at line 1: `)' unexpected *** Exit 2 Stop. *** Exit 1 Stop. $ make V=0 make all-am echo "AM_V_CC = '@echo " CC " pcre_compile.lo;)'" # for automake debugging AM_V_CC = '@echo CC pcre_compile.lo;)' sh: syntax error at line 1: `)' unexpected *** Exit 2 Stop. *** Exit 1 Stop. $ make V=1 make all-am echo "AM_V_CC = ')'" # for automake debugging AM_V_CC = ')' ) source='../pcre_compile.c' object='pcre_compile.lo' libtool=yes DEPDIR=.deps depmode=none /usr/local/bin/bash ../depcomp /usr/local/bin/bash ./libtool ) --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -O2 -c -o pcre_compile.lo ../pcre_compile.c sh: syntax error at line 1: `)' unexpected *** Exit 2 Stop. *** Exit 1 Stop. I fiddled around with the assignments where $(AM_DEFAULT_VERBOSITY) and $(V) are used. Turns out that if you change these assignments from e.g. AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) to curly-braces-in-parens... AM_V_CC = $(am__v_CC_${V}) am__v_CC_ = $(am__v_CC_${AM_DEFAULT_VERBOSITY}) or parens-in-curly-braces... AM_V_CC = ${am__v_CC_$(V)} am__v_CC_ = ${am__v_CC_$(AM_DEFAULT_VERBOSITY)} ...then the variable references are processed correctly, and the silent- rules feature works as advertised. --Daniel -- Daniel Richard G. || skunk <at> iSKUNK.ORG My ASCII-art .sig got a bad case of Times New Roman.
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Tue, 01 Nov 2011 10:34:01 GMT) Full text and rfc822 format available.Message #8 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: bug-automake <at> gnu.org Cc: 9928 <at> debbugs.gnu.org, "Daniel Richard G." <skunk <at> iskunk.org> Subject: Re: bug#9928: AM_SILENT_RULES breakage with old make(1) Date: Tue, 1 Nov 2011 11:31:10 +0100
tags 9928 wontfix close 9928 thanks On Tuesday 01 November 2011, Daniel Richard wrote: > Hello list, > Hi Daniel, thanks for the report. > I've recently encountered some breakage in building a package > with Automake 1.11.1's new silent-rules feature enabled, on a > VM install of NeXTSTEP 3.3. An example: > > [SNIP] > > I fiddled around with the assignments where $(AM_DEFAULT_VERBOSITY) and > $(V) are used. Turns out that if you change these assignments [SNIP] to > curly-braces-in-parens... > > AM_V_CC = $(am__v_CC_${V}) > am__v_CC_ = $(am__v_CC_${AM_DEFAULT_VERBOSITY}) > > ...then the variable references are processed correctly, and the silent- > rules feature works as advertised. > Wikipedia tells me that NeXTSTEP is now 16 years old, so I have a quite strong opinion against the possitility of tweaking/uglifying automake in order to support such an ancient and corner case system. My advice is that, if you want to continue using NeXTSTEP, you install GNU make and use it instead of the native make. I'm thus closing this bug report as "won't fix". But if you more observations or remarks to add, feel free to continue the discussion here (we can still re-open the bug report at a later date, if the need arises). Thanks, Stefano
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Tue, 01 Nov 2011 10:42:04 GMT) Full text and rfc822 format available.Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Tue, 01 Nov 2011 11:06:02 GMT) Full text and rfc822 format available.Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Tue, 01 Nov 2011 11:06:02 GMT) Full text and rfc822 format available.bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Tue, 01 Nov 2011 17:32:02 GMT) Full text and rfc822 format available.Message #18 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Daniel Richard G." <skunk <at> iSKUNK.ORG> To: "Stefano Lattarini" <stefano.lattarini <at> gmail.com>, bug-automake <at> gnu.org Cc: 9928 <at> debbugs.gnu.org Subject: Re: bug#9928: AM_SILENT_RULES breakage with old make(1) Date: Tue, 01 Nov 2011 13:28:57 -0400
[Message part 1 (text/plain, inline)]
Hi Stefano, On Tue, 2011 Nov 1 11:31+0100, Stefano Lattarini wrote: > > Wikipedia tells me that NeXTSTEP is now 16 years old, so I have a > quite strong opinion against the possitility of tweaking/uglifying > automake in order to support such an ancient and corner case system. > My advice is that, if you want to continue using NeXTSTEP, you install > GNU make and use it instead of the native make. > > I'm thus closing this bug report as "won't fix". But if you more > observations or remarks to add, feel free to continue the discussion > here (we can still re-open the bug report at a later date, if the need > arises). A few remarks: * This isn't about NeXTSTEP, but more broadly about older make(1) implementations. NeXTSTEP is built on BSD; this is an old BSD make, so the same problem is likely to crop up on other old BSD and BSD-derived systems. * All other aspects of the Automake-generated makefiles (that I've tried) are compatible with this old make. It's not like there are a number of other issues that would not be worth the effort to fix, just this one. * The incompatibility here is particularly pressing, because if a package uses AM_SILENT_RULES, there is no way of configuring it that will hide away the nested variable references, and thereby the deadly parens. --disable-silent-rules only changes AM_DEFAULT_VERBOSITY. The situation would be different if this controlled some AM_CONDITIONAL- like logic that could comment out the troublesome constructs altogether, but that's not how it's implemented. (Running "make AM_V_CC=" isn't a solution either, because this make can't override variables defined in the makefile, let alone recursed makefiles. And users wouldn't know to do this anyway.) * What is the cost/benefit to breaking compatibility here? Is avoiding uglification worth losing the ability to work with this old make? I do understand that sometimes, breaking compatibility with old systems can be a big win for flexibility. When the Autoconf folks decided that they would use shell functions in generated configure scripts instead of faking them via M4 macros, they lost the ability to run on museum-piece /bin/sh implementations (pre-dating NeXTSTEP) that don't know about functions. But they gained a useful construct for organizing and simplifying configure scripts whose value was more than worth the systems left out in the cold. I don't see what is being gained here that is worth the cost. For my part, I don't use Autotools because they are beautiful; I use them because they *work*. * The patch to address this issue touches only two lines of code. (See attached, against automake-1.11.1) --Daniel -- Daniel Richard G. || skunk <at> iSKUNK.ORG My ASCII-art .sig got a bad case of Times New Roman.
[verbose-var-fix.patch (text/x-patch, attachment)]
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Tue, 01 Nov 2011 17:32:02 GMT) Full text and rfc822 format available.Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Wed, 30 Nov 2011 12:24:02 GMT) Full text and rfc822 format available.Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Wed, 07 Dec 2011 22:38:02 GMT) Full text and rfc822 format available.Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Wed, 07 Dec 2011 22:38:03 GMT) Full text and rfc822 format available.Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Wed, 07 Dec 2011 22:38:03 GMT) Full text and rfc822 format available.Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Wed, 07 Dec 2011 22:40:02 GMT) Full text and rfc822 format available.Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Wed, 07 Dec 2011 22:42:01 GMT) Full text and rfc822 format available.Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Wed, 07 Dec 2011 22:42:02 GMT) Full text and rfc822 format available.Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Wed, 07 Dec 2011 22:42:02 GMT) Full text and rfc822 format available.Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Wed, 07 Dec 2011 22:42:02 GMT) Full text and rfc822 format available.bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Sat, 10 Dec 2011 22:59:02 GMT) Full text and rfc822 format available.Message #42 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Stefano Lattarini <stefano.lattarini <at> gmail.com> Cc: 9928 <at> debbugs.gnu.org, Eric Blake <eblake <at> redhat.com>, 10237 <at> debbugs.gnu.org, skunk <at> iskunk.org Subject: Re: bug#10237: AM_SILENT_RULES does not work with NonStop make Date: Sat, 10 Dec 2011 14:57:49 -0800
[Message part 1 (text/plain, inline)]
On 12/06/11 11:02, Stefano Lattarini wrote: > If you are interested in accomodating this fringe situation, I will > then accept a patch on the lines Paul has proposed (with a mandatory > testcase, otherwise it would be far too easy to regress in such a > almost-never-excercised corner case). OK, a proposed patch is below. It changes the silent-rules test case to check the new behavior; hope that's what you're asking for. Comments are welcome. The patch below is just the human-edited parts. A full patch (including the autogenerated parts) is attached, as a compressed file. automake: port silent-rules option to POSIX make This fixes two problems reported for Automake (Bug#9928, Bug#10237) and is in response to a bug report for building coreutils on HP NonStop OS (Bug#10234). The basic idea is that instead of generating Makefile.in lines like "AM_V_CC = $(am__v_CC_$(V))", we generate "AM_V_CC = $(am__v_CC_ <at> am__V@)". We then AC_SUBST $(V) for @am__V@ in the usual case where `make' supports nested variables, and substitute 1 (or 0) otherwise. Similarly for usages like $(am__v_CC_$(AM_DEFAULT_VERBOSITY)). * NEWS: Document this. * automake.in (define_verbose_var): When defining the variable, use @am__V@ rather than $(V), and likewise for @am__DEFAULT_VERBOSITY@ and $(AM_DEFAULT_VERBOSITY). (handle_options): silent-rules no longer overrides portability-recursive. * doc/automake.texi (Invoking Automake): silent-rules no longer overrides portability-recursive. (Automake silent-rules Option): Explain new system. * m4/silent.m4 (AM_SILENT_RULES): Check whether `make' supports nested variables, and substitute am__V and am__DEFAULT_VERBOSITY accordingly. * tests/silent-nowarn.test: Check that silent-rules no longer overrides portability-recursive. diff --git a/NEWS b/NEWS index da9af08..615f420 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,14 @@ +* Changes to automake: + + - The `silent-rules' option now generates working makefiles even for + the uncommon `make' implementations that do not support the + nested-variables extension to POSIX 2008. For such `make' + implementations, whether a build is silent is determined at + configure time, and cannot be overridden at make time with `make + V=0' or `make V=1'. Since the `silent-rules' option no longer + requires nested variables, it no longer disables the + nested-variables warning. + New in 1.11a: * Changes to automake: diff --git a/automake.in b/automake.in index 0b6d014..d61af86 100644 --- a/automake.in +++ b/automake.in @@ -1141,9 +1141,8 @@ sub define_verbose_var ($$) my $silent_var = $pvar . '_0'; if (option 'silent-rules') { - # Using `$V' instead of `$(V)' breaks IRIX make. - define_variable ($var, '$(' . $pvar . '_$(V))', INTERNAL); - define_variable ($pvar . '_', '$(' . $pvar . '_$(AM_DEFAULT_VERBOSITY))', INTERNAL); + define_variable ($var, '$(' . $pvar . '_@'.'am__V'.'@)', INTERNAL); + define_variable ($pvar . '_', '$(' . $pvar . '_@'.'am__DEFAULT_VERBOSITY'.'@)', INTERNAL); Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val, '', INTERNAL, VAR_ASIS) if (! vardef ($silent_var, TRUE)); @@ -1236,10 +1235,6 @@ sub handle_options return 1 if process_option_list (@options); } - # Override portability-recursive warning. - switch_warning ('no-portability-recursive') - if option 'silent-rules'; - if ($strictness == GNITS) { set_option ('readme-alpha', INTERNAL); diff --git a/doc/automake.texi b/doc/automake.texi index e937715..8214787 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -2702,8 +2702,6 @@ variables. The categories output by default are @samp{syntax} and @samp{unsupported}. Additionally, @samp{gnu} and @samp{portability} are enabled in @option{--gnu} and @option{--gnits} strictness. -On the other hand, the @option{silent-rules} options (@pxref{Options}) -turns off portability warnings about recursive variable expansions. @c Checked by extra-portability.test Turning off @samp{portability} will also turn off @samp{extra-portability}, @@ -10141,19 +10139,14 @@ Users who prefer to have silent rules enabled by default can edit their default to @samp{yes}. This should still allow disabling silent rules at @command{configure} time and at @command{make} time. -@c FIXME: there's really a need to specify this explicitly? -For portability to different @command{make} implementations, package authors -are advised to not set the variable @code{V} inside the @file{Makefile.am} -file, to allow the user to override the value for subdirectories as well. - -The current implementation of this feature relies on a non-POSIX, but in -practice rather widely supported @file{Makefile} construct of nested -variable expansion @samp{$(@var{var1}$(V))}. Do not use the -@option{silent-rules} option if your package needs to build with -@command{make} implementations that do not support it. The -@option{silent-rules} option turns off warnings about recursive variable -expansion, which are in turn enabled by @option{-Wportability} -(@pxref{Invoking Automake}). +The current implementation of this feature normally uses nested +variable expansion @samp{$(@var{var1}$(V))}, a @file{Makefile} feature +that is not required by POSIX 2008 but is widely supported in +practice. On the rare @command{make} implementations that do not +support nested variable expansion, whether rules are silent is always +determined at configure time, and cannot be overridden at make time. +Future versions of POSIX are likely to require nested variable +expansion, so this minor limitation should go away with time. @vindex @code{AM_V_GEN} @vindex @code{AM_V_at} diff --git a/m4/silent.m4 b/m4/silent.m4 index 432dd45..2a4446c 100644 --- a/m4/silent.m4 +++ b/m4/silent.m4 @@ -5,7 +5,7 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # AM_SILENT_RULES([DEFAULT]) # -------------------------- @@ -25,6 +25,34 @@ case $enable_silent_rules in @%:@ ((( no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_nested_variables], + [am_makefile=' +TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit +' +if echo "$am_makefile" | $am_make -s -f - >/dev/null 2>&1; then + am_cv_make_nested_variables=yes +else + am_cv_make_nested_variables=no +fi]) +if test $am_cv_make_nested_variables = yes; then + am__V='$(V)' + am__DEFAULT_VERBOSITY='$(AM_DEFAULT_VERBOSITY)' +else + am__V=$AM_DEFAULT_VERBOSITY + am__DEFAULT_VERBOSITY=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([am__V])dnl +AM_SUBST_NOTMAKE([am__V])dnl +AC_SUBST([am__DEFAULT_VERBOSITY])dnl +AM_SUBST_NOTMAKE([am__DEFAULT_VERBOSITY])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl diff --git a/tests/silent-nowarn.test b/tests/silent-nowarn.test index f0f5e70..9742bc3 100755 --- a/tests/silent-nowarn.test +++ b/tests/silent-nowarn.test @@ -14,7 +14,7 @@ # 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 that the 'silent-rules' mode suppresses the warnings for recursive +# Check that the 'silent-rules' mode does not suppress warnings for recursive # make variable expansions. This should happen regardless of whether and # where these warnings are requested. @@ -39,6 +39,5 @@ END touch AUTHORS ChangeLog COPYING INSTALL NEWS README THANKS $ACLOCAL -$AUTOMAKE --gnu -Wall -Wportability-recursive - -: +AUTOMAKE_fails --gnu -Wall -Wportability-recursive +grep 'recursive variable expansion' stderr
[full-patch.gz (application/x-gzip, attachment)]
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Sun, 11 Dec 2011 09:45:03 GMT) Full text and rfc822 format available.Message #45 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: 9928 <at> debbugs.gnu.org, Eric Blake <eblake <at> redhat.com>, 10237 <at> debbugs.gnu.org, skunk <at> iskunk.org Subject: Re: bug#10237: AM_SILENT_RULES does not work with NonStop make Date: Sun, 11 Dec 2011 10:42:44 +0100
Hi Paul. On Saturday 10 December 2011, Paul Eggert wrote: > On 12/06/11 11:02, Stefano Lattarini wrote: > > If you are interested in accomodating this fringe situation, I will > > then accept a patch on the lines Paul has proposed (with a mandatory > > testcase, otherwise it would be far too easy to regress in such a > > almost-never-excercised corner case). > > OK, a proposed patch is below. It changes the silent-rules test case > to check the new behavior; hope that's what you're asking for. > No, I was asking for a test case that simulates the presence of a make implementation unable to grasp nested variable expansions, that checks that the new code correctly kicks in such a situation (this can be done by grepping configure output and generated Makefile), and that the build process truly works as expected both with `--enable-silent-rules' and with `--disable-silent-rules' (see test `silent.test' for inspiration about how to do so). Otherwise the new code would remain basically uncovered in our testsuite for the very fringe and thorny situation we are trying to fix, which IMO is a big no-no. > Comments are welcome. > See them inlined below. > The patch below is just the human-edited parts. A full patch > (including the autogenerated parts) is attached, as a compressed file. > First nit: since this patch is a basically a bugfix (albeit for a very corner-case bug), I think it should be applied to the maintenance line of automake. So, could you please rebase your patch on maint? Thanks. > automake: port silent-rules option to POSIX make > s/POSIX make/fringe make implementations/, maybe? > This fixes two problems reported for Automake (Bug#9928, Bug#10237) > and is in response to a bug report for building coreutils on > HP NonStop OS (Bug#10234). > A brief description of the problem here would be nice. Would you mind condensing one from the mailing list discussions? > The basic idea is that instead of > generating Makefile.in lines like "AM_V_CC = $(am__v_CC_$(V))", > we generate "AM_V_CC = $(am__v_CC_ <at> am__V@)". We then AC_SUBST > $(V) for @am__V@ in the usual case where `make' supports > nested variables, and substitute 1 (or 0) otherwise. > Here I'd add something like: With this change, make implementations that doesn't grasp nested variable expansions will still be able to run Makefile generated using the `silent-rules' option; of course, they won't allow the user to override the make verbosity at runtime through redefintion of $(V) (as in "make V=0"); but this is still an improvement over not being able to work at all. > Similarly for usages like $(am__v_CC_$(AM_DEFAULT_VERBOSITY)). > * NEWS: Document this. > * automake.in (define_verbose_var): When defining the variable, > use @am__V@ rather than $(V), > and likewise for @am__DEFAULT_VERBOSITY@ and $(AM_DEFAULT_VERBOSITY). > Maybe substitute this with a simpler "and @am__DEFAULT_VERBOSITY@ rather than $(AM_DEFAULT_VERBOSITY)" ? > (handle_options): silent-rules no longer overrides > portability-recursive. > Bad idea, unless you also change the documentation in the manual about how to write custom "silenceable rules": You can add your own variables, so strings of your own choice are shown. The following snippet shows how you would define your own equivalent of AM_V_GEN: pkg_verbose = $(pkg_verbose_$(V)) pkg_verbose_ = $(pkg_verbose_$(AM_DEFAULT_VERBOSITY)) pkg_verbose_0 = @echo GEN $@; foo: foo.in $(pkg_verbose)cp $(srcdir)/foo.in $@ > * doc/automake.texi (Invoking Automake): silent-rules no longer > overrides portability-recursive. > (Automake silent-rules Option): Explain new system. > * m4/silent.m4 (AM_SILENT_RULES): Check whether `make' supports > nested variables, and substitute am__V and am__DEFAULT_VERBOSITY > accordingly. > * tests/silent-nowarn.test: Check that silent-rules no longer > overrides portability-recursive. > diff --git a/NEWS b/NEWS > index da9af08..615f420 100644 > --- a/NEWS > +++ b/NEWS > @@ -1,3 +1,14 @@ > +* Changes to automake: > + > + - The `silent-rules' option now generates working makefiles even for > + the uncommon `make' implementations that do not support the > + nested-variables extension to POSIX 2008. For such `make' > + implementations, whether a build is silent is determined at > + configure time, and cannot be overridden at make time with `make > + V=0' or `make V=1'. Since the `silent-rules' option no longer > + requires nested variables, it no longer disables the > + nested-variables warning. > + > This NEWS entry should go in the "Bugs fixed in 1.11a" section, "Bugs introduced by 1.11" subsection. > diff --git a/automake.in b/automake.in > index 0b6d014..d61af86 100644 > --- a/automake.in > +++ b/automake.in > @@ -1141,9 +1141,8 @@ sub define_verbose_var ($$) > my $silent_var = $pvar . '_0'; > if (option 'silent-rules') > { > - # Using `$V' instead of `$(V)' breaks IRIX make. > Here, I'd add a pointer to comments in m4/silent.m4, since this code has become decidedly non-obvious enough to deserve an examplnation. > - define_variable ($var, '$(' . $pvar . '_$(V))', INTERNAL); > - define_variable ($pvar . '_', '$(' . $pvar . '_$(AM_DEFAULT_VERBOSITY))', INTERNAL); > + define_variable ($var, '$(' . $pvar . '_@'.'am__V'.'@)', INTERNAL); > + define_variable ($pvar . '_', '$(' . $pvar . '_@'.'am__DEFAULT_VERBOSITY'.'@)', INTERNAL); > Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val, > '', INTERNAL, VAR_ASIS) > if (! vardef ($silent_var, TRUE)); > @@ -1236,10 +1235,6 @@ sub handle_options > return 1 if process_option_list (@options); > } > > - # Override portability-recursive warning. > - switch_warning ('no-portability-recursive') > - if option 'silent-rules'; > - > Don't do this without also updating the documentation. Thanks. > if ($strictness == GNITS) > { > set_option ('readme-alpha', INTERNAL); > diff --git a/doc/automake.texi b/doc/automake.texi > index e937715..8214787 100644 > --- a/doc/automake.texi > +++ b/doc/automake.texi > @@ -2702,8 +2702,6 @@ variables. > The categories output by default are @samp{syntax} and > @samp{unsupported}. Additionally, @samp{gnu} and @samp{portability} > are enabled in @option{--gnu} and @option{--gnits} strictness. > -On the other hand, the @option{silent-rules} options (@pxref{Options}) > -turns off portability warnings about recursive variable expansions. > > @c Checked by extra-portability.test > Turning off @samp{portability} will also turn off @samp{extra-portability}, > @@ -10141,19 +10139,14 @@ Users who prefer to have silent rules enabled by default can edit their > default to @samp{yes}. This should still allow disabling silent rules > at @command{configure} time and at @command{make} time. > > -@c FIXME: there's really a need to specify this explicitly? > -For portability to different @command{make} implementations, package authors > -are advised to not set the variable @code{V} inside the @file{Makefile.am} > -file, to allow the user to override the value for subdirectories as well. > - Whay are you removing this advice? > -The current implementation of this feature relies on a non-POSIX, but in > -practice rather widely supported @file{Makefile} construct of nested > -variable expansion @samp{$(@var{var1}$(V))}. Do not use the > -@option{silent-rules} option if your package needs to build with > -@command{make} implementations that do not support it. The > -@option{silent-rules} option turns off warnings about recursive variable > -expansion, which are in turn enabled by @option{-Wportability} > -(@pxref{Invoking Automake}). > +The current implementation of this feature normally uses nested > +variable expansion @samp{$(@var{var1}$(V))}, a @file{Makefile} feature > +that is not required by POSIX 2008 but is widely supported in > +practice. On the rare @command{make} implementations that do not > +support nested variable expansion, whether rules are silent is always > +determined at configure time, and cannot be overridden at make time. > > +Future versions of POSIX are likely to require nested variable > +expansion, so this minor limitation should go away with time. > > @vindex @code{AM_V_GEN} > @vindex @code{AM_V_at} > diff --git a/m4/silent.m4 b/m4/silent.m4 > index 432dd45..2a4446c 100644 > --- a/m4/silent.m4 > +++ b/m4/silent.m4 > @@ -5,7 +5,7 @@ > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. > > -# serial 2 > +# serial 3 > > # AM_SILENT_RULES([DEFAULT]) > # -------------------------- > @@ -25,6 +25,34 @@ case $enable_silent_rules in @%:@ ((( > no) AM_DEFAULT_VERBOSITY=1;; > *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; > esac > +am_make=${MAKE-make} > +AC_CACHE_CHECK([whether $am_make supports nested variables], > Here, I'd add a short comment for why this is needed, give a pointer to the bug reports this code is trying to fix. For example: # Some fringe make implementations (e.g., NonStop make and # NextStep make) don't grasp nested variable expansions. # See automake bug#10237 and bug#9928. > + [am_cv_make_nested_variables], > Hmmm... maybe a name like `am_cv_make_support_nested_variables' would be more appropriate? Or would it be just longer? > + [am_makefile=' > +TRUE=$(BAR$(V)) > +BAR0=false > +BAR1=true > +V=1 > +am__doit: > + @$(TRUE) > +.PHONY: am__doit > +' > +if echo "$am_makefile" | $am_make -s -f - >/dev/null 2>&1; then > `-s' make option shouldn't be needed here; also, I'd use AS_ECHO instead of bare echo, even if that is probably not required (call it extra safety, or cargo-cult programmming if you want :-) > + am_cv_make_nested_variables=yes > +else > + am_cv_make_nested_variables=no > +fi]) > +if test $am_cv_make_nested_variables = yes; then > + am__V='$(V)' > Please re-add here the comment you've removed from automake.in: # Using `$V' instead of `$(V)' would break IRIX make. am__V='$(V)' > + am__DEFAULT_VERBOSITY='$(AM_DEFAULT_VERBOSITY)' > +else > + am__V=$AM_DEFAULT_VERBOSITY > + am__DEFAULT_VERBOSITY=$AM_DEFAULT_VERBOSITY > +fi > +AC_SUBST([am__V])dnl > +AM_SUBST_NOTMAKE([am__V])dnl > +AC_SUBST([am__DEFAULT_VERBOSITY])dnl > +AM_SUBST_NOTMAKE([am__DEFAULT_VERBOSITY])dnl > AC_SUBST([AM_DEFAULT_VERBOSITY])dnl > AM_BACKSLASH='\' > AC_SUBST([AM_BACKSLASH])dnl > diff --git a/tests/silent-nowarn.test b/tests/silent-nowarn.test > index f0f5e70..9742bc3 100755 > --- a/tests/silent-nowarn.test > +++ b/tests/silent-nowarn.test > @@ -14,7 +14,7 @@ > # 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 that the 'silent-rules' mode suppresses the warnings for recursive > +# Check that the 'silent-rules' mode does not suppress warnings for recursive > # make variable expansions. This should happen regardless of whether and > # where these warnings are requested. > > @@ -39,6 +39,5 @@ END > touch AUTHORS ChangeLog COPYING INSTALL NEWS README THANKS > > $ACLOCAL > -$AUTOMAKE --gnu -Wall -Wportability-recursive > - > -: > +AUTOMAKE_fails --gnu -Wall -Wportability-recursive > +grep 'recursive variable expansion' stderr > Please keep the trailing `:' here: AUTOMAKE_fails --gnu -Wall -Wportability-recursive grep 'recursive variable expansion' stderr : Thanks, Stefano
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Wed, 21 Dec 2011 01:33:02 GMT) Full text and rfc822 format available.Message #48 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Stefano Lattarini <stefano.lattarini <at> gmail.com> Cc: 9928 <at> debbugs.gnu.org, Eric Blake <eblake <at> redhat.com>, 10237 <at> debbugs.gnu.org, skunk <at> iskunk.org Subject: Re: bug#10237: AM_SILENT_RULES does not work with NonStop make Date: Tue, 20 Dec 2011 17:30:20 -0800
On 12/11/11 01:42, Stefano Lattarini wrote: > I was asking for a test case that simulates the presence of a > make implementation unable to grasp nested variable expansions Ah, OK, revised patch enclosed below. This patch should address your other comments too. Thanks for the careful review. From 07edd4aa81af2a8fb982427705a2009c2b7eb0bf Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert <at> cs.ucla.edu> Date: Tue, 20 Dec 2011 17:29:06 -0800 Subject: [PATCH] automake: silent-rules no longer requires nested vars This fixes two problems reported for Automake (Bug#9928, Bug#10237) and is in response to a bug report for building coreutils on HP NonStop OS (Bug#10234). The problem is that HP NonStop 'make' treats a line like "AM_V_CC = $(am__v_CC_$(V))" as one that expands a macro with the funny name am__v_CC_$(V instead of the desired name am__v_CC_1 or am__v_CC_0, and since the funny macro is not defined the line is equivalent to "AM_V_CC = )"; this inserts a stray ")" when $(AM_V_CC) is used, which eventually causes 'make' to fail. The basic idea is that instead of generating Makefile.in lines like "AM_V_CC = $(am__v_CC_$(V))", we generate "AM_V_CC = $(am__v_CC_ <at> AM_V@)". We then AC_SUBST $(V) for @AM_V@ in the usual case where `make' supports nested variables, and substitute 1 (or 0) otherwise. Similarly for usages like $(am__v_CC_$(AM_DEFAULT_VERBOSITY)). With this change, make implementations that doesn't grasp nested variable expansions will still be able to run Makefiles generated using the silent-rules option. They won't allow the user to override the make verbosity at runtime through redefinition of $(V) (as in "make V=0"); but this is still an improvement over not being able to work at all. * NEWS: Document this. * automake.in (define_verbose_var): When defining the variable, use @AM_V@ rather than $(V), and use @AM_AM_DEFAULT_VERBOSITY@ rather than $(AM_DEFAULT_VERBOSITY). * doc/automake.texi (Automake silent-rules Option): Explain new system. * m4/silent.m4 (AM_SILENT_RULES): Check whether `make' supports nested variables, and substitute AM_V and AM_AM_DEFAULT_VERBOSITY accordingly. * tests/silent-nested-vars.test: New file. * tests/Makefile.am (TESTS): Add it. * tests/Makefile.in: Regenerate. --- ChangeLog | 40 +++++++++++++++ NEWS | 7 +++ automake.in | 9 ++- doc/automake.texi | 22 +++++---- m4/silent.m4 | 33 +++++++++++- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/silent-nested-vars.test | 111 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 209 insertions(+), 15 deletions(-) create mode 100755 tests/silent-nested-vars.test diff --git a/ChangeLog b/ChangeLog index 49b6e8b..b2d6e11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,43 @@ +2011-12-11 Paul Eggert <eggert <at> cs.ucla.edu> + + automake: silent-rules no longer requires nested vars + + This fixes two problems reported for Automake (Bug#9928, Bug#10237) + and is in response to a bug report for building coreutils on HP + NonStop OS (Bug#10234). The problem is that HP NonStop 'make' + treats a line like "AM_V_CC = $(am__v_CC_$(V))" as one that + expands a macro with the funny name am__v_CC_$(V instead of the + desired name am__v_CC_1 or am__v_CC_0, and since the funny macro + is not defined the line is equivalent to "AM_V_CC = )"; this + inserts a stray ")" when $(AM_V_CC) is used, which eventually + causes 'make' to fail. + + The basic idea is that instead of generating Makefile.in lines like + "AM_V_CC = $(am__v_CC_$(V))", we generate + "AM_V_CC = $(am__v_CC_ <at> AM_V@)". We then AC_SUBST $(V) for @AM_V@ + in the usual case where `make' supports nested variables, + and substitute 1 (or 0) otherwise. Similarly for usages like + $(am__v_CC_$(AM_DEFAULT_VERBOSITY)). + + With this change, make implementations that doesn't grasp nested + variable expansions will still be able to run Makefiles generated + using the silent-rules option. They won't allow the user to + override the make verbosity at runtime through redefinition of + $(V) (as in "make V=0"); but this is still an improvement over not + being able to work at all. + + * NEWS: Document this. + * automake.in (define_verbose_var): When defining the variable, + use @AM_V@ rather than $(V), and use + @AM_AM_DEFAULT_VERBOSITY@ rather than $(AM_DEFAULT_VERBOSITY). + * doc/automake.texi (Automake silent-rules Option): Explain new system. + * m4/silent.m4 (AM_SILENT_RULES): Check whether `make' supports + nested variables, and substitute AM_V and AM_AM_DEFAULT_VERBOSITY + accordingly. + * tests/silent-nested-vars.test: New file. + * tests/Makefile.am (TESTS): Add it. + * tests/Makefile.in: Regenerate. + 2011-12-20 Peter Rosin <peda <at> lysator.liu.se> tests: fix spurious failure on systems lacking unistd.h diff --git a/NEWS b/NEWS index 46803a7..58c90c9 100644 --- a/NEWS +++ b/NEWS @@ -74,6 +74,13 @@ Bugs fixed in 1.11.0a: not used, `make' output no longer contains spurious backslash-only lines, thus once again matching what Automake did before 1.11. + - The `silent-rules' option now generates working makefiles even for + the uncommon `make' implementations that do not support the + nested-variables extension to POSIX 2008. For such `make' + implementations, whether a build is silent is determined at + configure time, and cannot be overridden at make time with `make + V=0' or `make V=1'. + - The AM_COND_IF macro also works if the shell expression for the conditional is no longer valid for the condition. diff --git a/automake.in b/automake.in index db7f3c6..ae2011c 100755 --- a/automake.in +++ b/automake.in @@ -1161,9 +1161,12 @@ sub define_verbose_var ($$) my $silent_var = $pvar . '_0'; if (option 'silent-rules') { - # Using `$V' instead of `$(V)' breaks IRIX make. - define_variable ($var, '$(' . $pvar . '_$(V))', INTERNAL); - define_variable ($pvar . '_', '$(' . $pvar . '_$(AM_DEFAULT_VERBOSITY))', INTERNAL); + # For typical `make's, `configure' replaces AM_V (inside @@) with $(V) + # and AM_AM_DEFAULT_VERBOSITY (inside @@) with $(AM_DEFAULT_VERBOSITY). + # For strict POSIX 2008 `make's, it replaces them with 0 or 1 instead. + # See AM_SILENT_RULES in m4/silent.m4. + define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL); + define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_AM_DEFAULT_VERBOSITY'.'@)', INTERNAL); Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val, '', INTERNAL, VAR_ASIS) if (! vardef ($silent_var, TRUE)); diff --git a/doc/automake.texi b/doc/automake.texi index a5f857d..1a689b6 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -10130,18 +10130,20 @@ For portability to different @command{make} implementations, package authors are advised to not set the variable @code{V} inside the @file{Makefile.am} file, to allow the user to override the value for subdirectories as well. -The current implementation of this feature relies on a non-POSIX, but in -practice rather widely supported @file{Makefile} construct of nested -variable expansion @samp{$(@var{var1}$(V))}. Do not use the -@option{silent-rules} option if your package needs to build with -@command{make} implementations that do not support it. The -@option{silent-rules} option turns off warnings about recursive variable -expansion, which are in turn enabled by @option{-Wportability} -(@pxref{Invoking Automake}). +The current implementation of this feature normally uses nested +variable expansion @samp{$(@var{var1}$(V))}, a @file{Makefile} feature +that is not required by POSIX 2008 but is widely supported in +practice. On the rare @command{make} implementations that do not +support nested variable expansion, whether rules are silent is always +determined at configure time, and cannot be overridden at make time. +Future versions of POSIX are likely to require nested variable +expansion, so this minor limitation should go away with time. @vindex @code{AM_V_GEN} @vindex @code{AM_V_at} @vindex @code{AM_DEFAULT_VERBOSITY} +@vindex @code{AM_V} +@vindex @code{AM_AM_DEFAULT_VERBOSITY} To extend the silent mode to your own rules, you have two choices: @itemize @bullet @@ -10157,8 +10159,8 @@ The following snippet shows how you would define your own equivalent of @code{AM_V_GEN}: @example -pkg_verbose = $(pkg_verbose_$(V)) -pkg_verbose_ = $(pkg_verbose_$(AM_DEFAULT_VERBOSITY)) +pkg_verbose = $(pkg_verbose_@@AM_V@@) +pkg_verbose_ = $(pkg_verbose_@@AM_AM_DEFAULT_VERBOSITY@@) pkg_verbose_0 = @@echo PKG-GEN $@@; foo: foo.in diff --git a/m4/silent.m4 b/m4/silent.m4 index 6d2a1a2..1928feb 100644 --- a/m4/silent.m4 +++ b/m4/silent.m4 @@ -1,11 +1,11 @@ ## -*- Autoconf -*- -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 +# serial 2 # AM_SILENT_RULES([DEFAULT]) # -------------------------- @@ -20,6 +20,35 @@ yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac +dnl +dnl A few `make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)'dnl Using `$V' instead of `$(V)' breaks IRIX make. + AM_AM_DEFAULT_VERBOSITY='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_AM_DEFAULT_VERBOSITY=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_AM_DEFAULT_VERBOSITY])dnl +AM_SUBST_NOTMAKE([AM_AM_DEFAULT_VERBOSITY])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl diff --git a/tests/Makefile.am b/tests/Makefile.am index 831906b..920d994 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -751,6 +751,7 @@ silent-many-gcc.test \ silent-many-generic.test \ silent-lex-gcc.test \ silent-lex-generic.test \ +silent-nested-vars.test \ silent-yacc-gcc.test \ silent-yacc-generic.test \ silent-configsite.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 3ad0146..470ed6c 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1035,6 +1035,7 @@ silent-many-gcc.test \ silent-many-generic.test \ silent-lex-gcc.test \ silent-lex-generic.test \ +silent-nested-vars.test \ silent-yacc-gcc.test \ silent-yacc-generic.test \ silent-configsite.test \ diff --git a/tests/silent-nested-vars.test b/tests/silent-nested-vars.test new file mode 100755 index 0000000..6716930 --- /dev/null +++ b/tests/silent-nested-vars.test @@ -0,0 +1,111 @@ +#!/bin/sh +# Copyright (C) 2011 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 2, 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 silent-rules mode, on 'make' implementations that do not +# support nested variables. + +. ./defs || Exit 1 + +set -e + +mkdir sub + +cat >>configure.in <<'EOF' +AM_SILENT_RULES +AC_CONFIG_FILES([sub/Makefile]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_OUTPUT +EOF + +cat > Makefile.am <<'EOF' +# Need generic and non-generic rules. +bin_PROGRAMS = foo bar +bar_CFLAGS = $(AM_CFLAGS) +SUBDIRS = sub +EOF + +cat > sub/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = subdir-objects +# Need generic and non-generic rules. +bin_PROGRAMS = baz bla +bla_CFLAGS = $(AM_CFLAGS) +EOF + +cat > foo.c <<'EOF' +int main () +{ + return 0; +} +EOF +cp foo.c bar.c +cp foo.c sub/baz.c +cp foo.c sub/bla.c + +cat >mymake <<'EOF' +#! /bin/sh +makerules= + +case $1 in + -f) + makefile=$2 + case $2 in + -) makerules=`cat` || exit ;; + esac ;; + *) + for makefile in makefile Makefile; do + test -f $makefile && break + done ;; +esac + +if printf '%s\n' "$makerules" | LC_ALL=C grep '\$([a-zA-Z0-9_]*\$' $makefile +then + echo >&2 "mymake: $makefile contains nested variables" + exit 1 +fi +exec $mymake_MAKE "$@" +EOF +chmod a+x mymake +mymake_MAKE=${MAKE-make} +export mymake_MAKE + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +./configure --enable-silent-rules MAKE=./mymake +./mymake >stdout || { cat stdout; Exit 1; } +cat stdout +$EGREP ' (-c|-o)' stdout && Exit 1 +grep 'mv ' stdout && Exit 1 +grep 'CC .*foo\.' stdout +grep 'CC .*bar\.' stdout +grep 'CC .*baz\.' stdout +grep 'CC .*bla\.' stdout +grep 'CCLD .*foo' stdout +grep 'CCLD .*bar' stdout +grep 'CCLD .*baz' stdout +grep 'CCLD .*bla' stdout + +./mymake clean +./configure --disable-silent-rules MAKE=./mymake +./mymake >stdout || { cat stdout; Exit 1; } +cat stdout +grep ' -c' stdout +grep ' -o foo' stdout +$EGREP '(CC|LD) ' stdout && Exit 1 + +: -- 1.7.6.4
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Wed, 21 Dec 2011 12:24:02 GMT) Full text and rfc822 format available.Message #51 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: 9928 <at> debbugs.gnu.org, Eric Blake <eblake <at> redhat.com>, 10237 <at> debbugs.gnu.org, skunk <at> iskunk.org Subject: Re: bug#9928: bug#10237: AM_SILENT_RULES does not work with NonStop make Date: Wed, 21 Dec 2011 13:21:26 +0100
Hi Paul, thanks for the respin. My comments and objections are inlined. On 12/21/2011 02:30 AM, Paul Eggert wrote: > On 12/11/11 01:42, Stefano Lattarini wrote: > >> I was asking for a test case that simulates the presence of a >> make implementation unable to grasp nested variable expansions > > Ah, OK, revised patch enclosed below. This patch should address > your other comments too. Thanks for the careful review. > > From 07edd4aa81af2a8fb982427705a2009c2b7eb0bf Mon Sep 17 00:00:00 2001 > From: Paul Eggert <eggert <at> cs.ucla.edu> > Date: Tue, 20 Dec 2011 17:29:06 -0800 > Subject: [PATCH] automake: silent-rules no longer requires nested vars > This sounds a little misleading to me; i.e., it sounds like we have reimplemented the silent-rules feature to work completely and at its best even with make implementations not supporting nested variables, which is not true. What about this instead? silent-rules: provide fallback for makes without nested variables support > This fixes two problems reported for Automake (Bug#9928, Bug#10237) > and is in response to a bug report for building coreutils on HP > NonStop OS (Bug#10234). The problem is that HP NonStop 'make' > treats a line like "AM_V_CC = $(am__v_CC_$(V))" as one that > expands a macro with the funny name am__v_CC_$(V instead of the > desired name am__v_CC_1 or am__v_CC_0, and since the funny macro > is not defined the line is equivalent to "AM_V_CC = )"; this > inserts a stray ")" when $(AM_V_CC) is used, which eventually > causes 'make' to fail. > Very good explanation. > The basic idea is that instead of generating Makefile.in lines like > "AM_V_CC = $(am__v_CC_$(V))", we generate > "AM_V_CC = $(am__v_CC_ <at> AM_V@)". We then AC_SUBST $(V) for @AM_V@ > in the usual case where `make' supports nested variables, > and substitute 1 (or 0) otherwise. Similarly for usages like > $(am__v_CC_$(AM_DEFAULT_VERBOSITY)). > > With this change, make implementations that doesn't grasp nested > variable expansions will still be able to run Makefiles generated > using the silent-rules option. They won't allow the user to > override the make verbosity at runtime through redefinition of > $(V) (as in "make V=0"); but this is still an improvement over not > being able to work at all. > And all this is good too. Thanks. > * NEWS: Document this. > * automake.in (define_verbose_var): When defining the variable, > use @AM_V@ rather than $(V), and use > @AM_AM_DEFAULT_VERBOSITY@ rather than $(AM_DEFAULT_VERBOSITY). > * doc/automake.texi (Automake silent-rules Option): Explain new system. > * m4/silent.m4 (AM_SILENT_RULES): Check whether `make' supports > nested variables, and substitute AM_V and AM_AM_DEFAULT_VERBOSITY > s/AM_AM_DEFAULT_VERBOSITY/AM_V_DEFAULT_VERBOSITY/ ? > accordingly. > * tests/silent-nested-vars.test: New file. > Micro-nit: I'd prefer s/file/test/ here (but this is not a requirement for an ACK!). > * tests/Makefile.am (TESTS): Add it. > * tests/Makefile.in: Regenerate. > Small nit: we don't mention changes to autogenerated-but-committed files in our ChangeLog entries and commit messages. > --- > ChangeLog | 40 +++++++++++++++ > NEWS | 7 +++ > automake.in | 9 ++- > doc/automake.texi | 22 +++++---- > m4/silent.m4 | 33 +++++++++++- > tests/Makefile.am | 1 + > tests/Makefile.in | 1 + > tests/silent-nested-vars.test | 111 +++++++++++++++++++++++++++++++++++++++++ > 8 files changed, 209 insertions(+), 15 deletions(-) > create mode 100755 tests/silent-nested-vars.test > > diff --git a/ChangeLog b/ChangeLog > index 49b6e8b..b2d6e11 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,43 @@ > +2011-12-11 Paul Eggert <eggert <at> cs.ucla.edu> > + > [SNIP ChangeLog entry] [The same comments given above for the git commit message applies, obviously]. > diff --git a/NEWS b/NEWS > index 46803a7..58c90c9 100644 > --- a/NEWS > +++ b/NEWS > @@ -74,6 +74,13 @@ Bugs fixed in 1.11.0a: > not used, `make' output no longer contains spurious backslash-only > lines, thus once again matching what Automake did before 1.11. > > + - The `silent-rules' option now generates working makefiles even for > + the uncommon `make' implementations that do not support the > + nested-variables extension to POSIX 2008. For such `make' > + implementations, whether a build is silent is determined at > + configure time, and cannot be overridden at make time with `make > + V=0' or `make V=1'. > + Very clear, thanks. > - The AM_COND_IF macro also works if the shell expression for the conditional > is no longer valid for the condition. > > diff --git a/automake.in b/automake.in > index db7f3c6..ae2011c 100755 > --- a/automake.in > +++ b/automake.in > @@ -1161,9 +1161,12 @@ sub define_verbose_var ($$) > my $silent_var = $pvar . '_0'; > if (option 'silent-rules') > { > - # Using `$V' instead of `$(V)' breaks IRIX make. > - define_variable ($var, '$(' . $pvar . '_$(V))', INTERNAL); > - define_variable ($pvar . '_', '$(' . $pvar . '_$(AM_DEFAULT_VERBOSITY))', INTERNAL); > + # For typical `make's, `configure' replaces AM_V (inside @@) with $(V) > + # and AM_AM_DEFAULT_VERBOSITY (inside @@) with $(AM_DEFAULT_VERBOSITY). > AM_AM_DEFAULT_VERBOSITY ? More instances below, in this and other files. > + # For strict POSIX 2008 `make's, it replaces them with 0 or 1 instead. > + # See AM_SILENT_RULES in m4/silent.m4. > + define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL); > + define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_AM_DEFAULT_VERBOSITY'.'@)', INTERNAL); > Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val, > '', INTERNAL, VAR_ASIS) > if (! vardef ($silent_var, TRUE)); > diff --git a/doc/automake.texi b/doc/automake.texi > index a5f857d..1a689b6 100644 > --- a/doc/automake.texi > +++ b/doc/automake.texi > @@ -10130,18 +10130,20 @@ For portability to different @command{make} implementations, package authors > are advised to not set the variable @code{V} inside the @file{Makefile.am} > file, to allow the user to override the value for subdirectories as well. > A > -The current implementation of this feature relies on a non-POSIX, but in > -practice rather widely supported @file{Makefile} construct of nested > -variable expansion @samp{$(@var{var1}$(V))}. Do not use the > -@option{silent-rules} option if your package needs to build with > -@command{make} implementations that do not support it. The > -@option{silent-rules} option turns off warnings about recursive variable > -expansion, which are in turn enabled by @option{-Wportability} > -(@pxref{Invoking Automake}). > +The current implementation of this feature normally uses nested > +variable expansion @samp{$(@var{var1}$(V))}, a @file{Makefile} feature > +that is not required by POSIX 2008 but is widely supported in > +practice. On the rare @command{make} implementations that do not > +support nested variable expansion, whether rules are silent is always > +determined at configure time, and cannot be overridden at make time. > +Future versions of POSIX are likely to require nested variable > +expansion, so this minor limitation should go away with time. > Good and clear explanation. > @vindex @code{AM_V_GEN} > @vindex @code{AM_V_at} > @vindex @code{AM_DEFAULT_VERBOSITY} > +@vindex @code{AM_V} > +@vindex @code{AM_AM_DEFAULT_VERBOSITY} > > To extend the silent mode to your own rules, you have two choices: > > @itemize @bullet > @@ -10157,8 +10159,8 @@ The following snippet shows how you would define your own equivalent of > @code{AM_V_GEN}: > > @example > -pkg_verbose = $(pkg_verbose_$(V)) > -pkg_verbose_ = $(pkg_verbose_$(AM_DEFAULT_VERBOSITY)) > +pkg_verbose = $(pkg_verbose_@@AM_V@@) > +pkg_verbose_ = $(pkg_verbose_@@AM_AM_DEFAULT_VERBOSITY@@) > Do we have a test verifying that the previously documented usage: pkg_verbose = $(pkg_verbose_$(V)) pkg_verbose_ = $(pkg_verbose_$(AM_DEFAULT_VERBOSITY)) still works with make implementations that support nested variable expansion, as it did before this change? More importantly, do we have a test verifying that the new documented usage: pkg_verbose = $(pkg_verbose_ <at> AM_V@) pkg_verbose_ = $(pkg_verbose_ <at> AM_AM_DEFAULT_VERBOSITY@) actually works as advised? > pkg_verbose_0 = @@echo PKG-GEN $@@; > > foo: foo.in > diff --git a/m4/silent.m4 b/m4/silent.m4 > index 6d2a1a2..1928feb 100644 > --- a/m4/silent.m4 > +++ b/m4/silent.m4 > @@ -1,11 +1,11 @@ > ## -*- Autoconf -*- > -# Copyright (C) 2009 Free Software Foundation, Inc. > +# Copyright (C) 2009, 2011 Free Software Foundation, Inc. > # > # This file is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. > > -# serial 1 > +# serial 2 > > # AM_SILENT_RULES([DEFAULT]) > # -------------------------- > @@ -20,6 +20,35 @@ yes) AM_DEFAULT_VERBOSITY=0;; > no) AM_DEFAULT_VERBOSITY=1;; > *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; > esac > +dnl > +dnl A few `make' implementations (e.g., NonStop OS and NextStep) > +dnl do not support nested variable expansions. > +dnl See automake bug#9928 and bug#10237. > +am_make=${MAKE-make} > +AC_CACHE_CHECK([whether $am_make supports nested variables], > + [am_cv_make_support_nested_variables], > + [if AS_ECHO([['TRUE=$(BAR$(V)) > +BAR0=false > +BAR1=true > +V=1 > +am__doit: > + @$(TRUE) > +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then > + am_cv_make_support_nested_variables=yes > +else > + am_cv_make_support_nested_variables=no > +fi]) > +if test $am_cv_make_support_nested_variables = yes; then > + AM_V='$(V)'dnl Using `$V' instead of `$(V)' breaks IRIX make. > Keep this comment on a separate line maybe? That would seem clearer to me: # Using `$V' instead of `$(V)' breaks IRIX make. AM_V='$(V)' > + AM_AM_DEFAULT_VERBOSITY='$(AM_DEFAULT_VERBOSITY)' > +else > + AM_V=$AM_DEFAULT_VERBOSITY > + AM_AM_DEFAULT_VERBOSITY=$AM_DEFAULT_VERBOSITY > +fi > +AC_SUBST([AM_V])dnl > +AM_SUBST_NOTMAKE([AM_V])dnl > +AC_SUBST([AM_AM_DEFAULT_VERBOSITY])dnl > +AM_SUBST_NOTMAKE([AM_AM_DEFAULT_VERBOSITY])dnl > AC_SUBST([AM_DEFAULT_VERBOSITY])dnl > AM_BACKSLASH='\' > AC_SUBST([AM_BACKSLASH])dnl > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 831906b..920d994 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -751,6 +751,7 @@ silent-many-gcc.test \ > silent-many-generic.test \ > silent-lex-gcc.test \ > silent-lex-generic.test \ > +silent-nested-vars.test \ > silent-yacc-gcc.test \ > silent-yacc-generic.test \ > silent-configsite.test \ > diff --git a/tests/Makefile.in b/tests/Makefile.in > index 3ad0146..470ed6c 100644 > --- a/tests/Makefile.in > +++ b/tests/Makefile.in > @@ -1035,6 +1035,7 @@ silent-many-gcc.test \ > silent-many-generic.test \ > silent-lex-gcc.test \ > silent-lex-generic.test \ > +silent-nested-vars.test \ > silent-yacc-gcc.test \ > silent-yacc-generic.test \ > silent-configsite.test \ > diff --git a/tests/silent-nested-vars.test b/tests/silent-nested-vars.test > new file mode 100755 > index 0000000..6716930 > --- /dev/null > +++ b/tests/silent-nested-vars.test > @@ -0,0 +1,111 @@ > +#!/bin/sh > +# Copyright (C) 2011 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 2, 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 silent-rules mode, on 'make' implementations that do not > +# support nested variables. > Could you please add a reference to the relevant bug numbers here as well? Thanks. > + > +. ./defs || Exit 1 > + > +set -e > + > +mkdir sub > + > +cat >>configure.in <<'EOF' > +AM_SILENT_RULES > +AC_CONFIG_FILES([sub/Makefile]) > +AC_PROG_CC > +AM_PROG_CC_C_O > +AC_OUTPUT > +EOF > + > +cat > Makefile.am <<'EOF' > +# Need generic and non-generic rules. > +bin_PROGRAMS = foo bar > +bar_CFLAGS = $(AM_CFLAGS) > +SUBDIRS = sub > +EOF > + > +cat > sub/Makefile.am <<'EOF' > +AUTOMAKE_OPTIONS = subdir-objects > +# Need generic and non-generic rules. > +bin_PROGRAMS = baz bla > +bla_CFLAGS = $(AM_CFLAGS) > +EOF > + Maybe trying out also subdir-objects is an overkill in the context of this patch ... Oh well, than can be fixed by a later patch if the need arise, so let's not worry about it now. > +cat > foo.c <<'EOF' > +int main () > +{ > + return 0; > +} > +EOF > +cp foo.c bar.c > +cp foo.c sub/baz.c > +cp foo.c sub/bla.c > + > +cat >mymake <<'EOF' > +#! /bin/sh > +makerules= > + > +case $1 in > + -f) > + makefile=$2 > + case $2 in > + -) makerules=`cat` || exit ;; > + esac ;; > + *) > + for makefile in makefile Makefile; do > + test -f $makefile && break > + done ;; > +esac > + > +if printf '%s\n' "$makerules" | LC_ALL=C grep '\$([a-zA-Z0-9_]*\$' $makefile > This seems wrong, as grep will not consider its standard input when given a non-empty argument. Or am I missing something? > +then > + echo >&2 "mymake: $makefile contains nested variables" > + exit 1 > +fi > +exec $mymake_MAKE "$@" > What if we had "-f -" among the arguments? The stdin meant for make will result to be already consumed by the previous `cat`... > +EOF > +chmod a+x mymake > +mymake_MAKE=${MAKE-make} > +export mymake_MAKE > + I'd add a sanity check here to verify that the `mymake' script really rejects Makefiles using nested variables: cat > Makefile <<'END' a = $(b$(c)) all: touch bar END ./mymake && Exit 99 mv -f Makefile foo.mk ./mymake -f foo.mkr && Exit 99 cat foo.mk | ./mymake -f - && Exit 99 test -f bar && Exit 99 sed '/a =/d' foo.mk > Makefile ./mymake && test -f bar || Exit 99 rm -f foo.mk bar Makefile Ugly, I know, but similar internal checks have saved me from testsuite bugs and false negatives a few times already. > +$ACLOCAL > +$AUTOMAKE --add-missing > +$AUTOCONF > + > +./configure --enable-silent-rules MAKE=./mymake > You should also grep configure output for: checking whether ./mymake supports nested variables... no and maybe the generated Makefile for the definition: AM_V = 1 > +./mymake >stdout || { cat stdout; Exit 1; } > +cat stdout > +$EGREP ' (-c|-o)' stdout && Exit 1 > +grep 'mv ' stdout && Exit 1 > +grep 'CC .*foo\.' stdout > +grep 'CC .*bar\.' stdout > +grep 'CC .*baz\.' stdout > +grep 'CC .*bla\.' stdout > +grep 'CCLD .*foo' stdout > +grep 'CCLD .*bar' stdout > +grep 'CCLD .*baz' stdout > +grep 'CCLD .*bla' stdout > + > +./mymake clean > +./configure --disable-silent-rules MAKE=./mymake > You should also grep configure output for: checking whether ./mymake supports nested variables... no and maybe the generated Makefile for the definition: AM_V = 0 > +./mymake >stdout || { cat stdout; Exit 1; } > +cat stdout > +grep ' -c' stdout > +grep ' -o foo' stdout > +$EGREP '(CC|LD) ' stdout && Exit 1 > + > +: Thanks, Stefano
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Thu, 22 Dec 2011 21:59:01 GMT) Full text and rfc822 format available.Message #54 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Stefano Lattarini <stefano.lattarini <at> gmail.com> Cc: 9928 <at> debbugs.gnu.org, Eric Blake <eblake <at> redhat.com>, 10237 <at> debbugs.gnu.org, skunk <at> iskunk.org Subject: Re: bug#9928: bug#10237: AM_SILENT_RULES does not work with NonStop make Date: Thu, 22 Dec 2011 13:56:22 -0800
On 12/21/11 04:21, Stefano Lattarini wrote: > Hi Paul, thanks for the respin. My comments and objections are inlined. Thanks, I have a patch updated with all those comments in mind. One followup: > AM_AM_DEFAULT_VERBOSITY ? I changed that to AM_DEFAULT_V, as that seems to fit into the naming convention better. From 939ba315f5e3e5caea0513af20724c35ead86956 Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert <at> cs.ucla.edu> Date: Thu, 22 Dec 2011 13:48:54 -0800 Subject: [PATCH] silent-rules: fallback for makes without nested vars This fixes two problems reported for Automake (Bug#9928, Bug#10237) and is in response to a bug report for building coreutils on HP NonStop OS (Bug#10234). The problem is that HP NonStop 'make' treats a line like "AM_V_CC = $(am__v_CC_$(V))" as one that expands a macro with the funny name am__v_CC_$(V instead of the desired name am__v_CC_1 or am__v_CC_0, and since the funny macro is not defined the line is equivalent to "AM_V_CC = )"; this inserts a stray ")" when $(AM_V_CC) is used, which eventually causes 'make' to fail. The basic idea is that instead of generating Makefile.in lines like "AM_V_CC = $(am__v_CC_$(V))", we generate "AM_V_CC = $(am__v_CC_ <at> AM_V@)". We then AC_SUBST $(V) for @AM_V@ in the usual case where `make' supports nested variables, and substitute 1 (or 0) otherwise. Similarly for usages like $(am__v_CC_$(AM_DEFAULT_VERBOSITY)). With this change, make implementations that doesn't grasp nested variable expansions will still be able to run Makefiles generated using the silent-rules option. They won't allow the user to override the make verbosity at runtime through redefinition of $(V) (as in "make V=0"); but this is still an improvement over not being able to work at all. * NEWS: Document this. * automake.in (define_verbose_var): When defining the variable, use @AM_V@ rather than $(V), and use @AM_DEFAULT_V@ rather than $(AM_DEFAULT_VERBOSITY). * doc/automake.texi (Automake silent-rules Option): Explain new system. * m4/silent.m4 (AM_SILENT_RULES): Check whether `make' supports nested variables, and substitute AM_V and AM_DEFAULT_V accordingly. * tests/silent-nested-vars.test: New test. * tests/Makefile.am (TESTS): Add it. --- ChangeLog | 39 ++++++++ NEWS | 7 ++ automake.in | 9 ++- doc/automake.texi | 22 +++-- m4/silent.m4 | 34 +++++++- tests/Makefile.am | 1 + tests/silent-nested-vars.test | 193 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 290 insertions(+), 15 deletions(-) create mode 100755 tests/silent-nested-vars.test diff --git a/ChangeLog b/ChangeLog index 26e4a2d..461dfac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2011-12-22 Paul Eggert <eggert <at> cs.ucla.edu> + + silent-rules: fallback for makes without nested vars + + This fixes two problems reported for Automake (Bug#9928, Bug#10237) + and is in response to a bug report for building coreutils on HP + NonStop OS (Bug#10234). The problem is that HP NonStop 'make' + treats a line like "AM_V_CC = $(am__v_CC_$(V))" as one that + expands a macro with the funny name am__v_CC_$(V instead of the + desired name am__v_CC_1 or am__v_CC_0, and since the funny macro + is not defined the line is equivalent to "AM_V_CC = )"; this + inserts a stray ")" when $(AM_V_CC) is used, which eventually + causes 'make' to fail. + + The basic idea is that instead of generating Makefile.in lines like + "AM_V_CC = $(am__v_CC_$(V))", we generate + "AM_V_CC = $(am__v_CC_ <at> AM_V@)". We then AC_SUBST $(V) for @AM_V@ + in the usual case where `make' supports nested variables, + and substitute 1 (or 0) otherwise. Similarly for usages like + $(am__v_CC_$(AM_DEFAULT_VERBOSITY)). + + With this change, make implementations that doesn't grasp nested + variable expansions will still be able to run Makefiles generated + using the silent-rules option. They won't allow the user to + override the make verbosity at runtime through redefinition of + $(V) (as in "make V=0"); but this is still an improvement over not + being able to work at all. + + * NEWS: Document this. + * automake.in (define_verbose_var): When defining the variable, + use @AM_V@ rather than $(V), and use @AM_DEFAULT_V@ rather than + $(AM_DEFAULT_VERBOSITY). + * doc/automake.texi (Automake silent-rules Option): Explain new system. + * m4/silent.m4 (AM_SILENT_RULES): Check whether `make' supports + nested variables, and substitute AM_V and AM_DEFAULT_V accordingly. + * tests/silent-nested-vars.test: New test. + * tests/Makefile.am (TESTS): Add it. + + 2011-12-22 Stefano Lattarini <stefano.lattarini <at> gmail.com> hacking: distribute it, and mention it in the ChangeLog diff --git a/NEWS b/NEWS index db448a9..80ed91e 100644 --- a/NEWS +++ b/NEWS @@ -84,6 +84,13 @@ Bugs fixed in 1.11.0a: not used, `make' output no longer contains spurious backslash-only lines, thus once again matching what Automake did before 1.11. + - The `silent-rules' option now generates working makefiles even for + the uncommon `make' implementations that do not support the + nested-variables extension to POSIX 2008. For such `make' + implementations, whether a build is silent is determined at + configure time, and cannot be overridden at make time with `make + V=0' or `make V=1'. + - The AM_COND_IF macro also works if the shell expression for the conditional is no longer valid for the condition. diff --git a/automake.in b/automake.in index 309eade..7efb7d5 100644 --- a/automake.in +++ b/automake.in @@ -1161,9 +1161,12 @@ sub define_verbose_var ($$) my $silent_var = $pvar . '_0'; if (option 'silent-rules') { - # Using `$V' instead of `$(V)' breaks IRIX make. - define_variable ($var, '$(' . $pvar . '_$(V))', INTERNAL); - define_variable ($pvar . '_', '$(' . $pvar . '_$(AM_DEFAULT_VERBOSITY))', INTERNAL); + # For typical `make's, `configure' replaces AM_V (inside @@) with $(V) + # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY). + # For strict POSIX 2008 `make's, it replaces them with 0 or 1 instead. + # See AM_SILENT_RULES in m4/silent.m4. + define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL); + define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)', INTERNAL); Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val, '', INTERNAL, VAR_ASIS) if (! vardef ($silent_var, TRUE)); diff --git a/doc/automake.texi b/doc/automake.texi index ced1b72..39884af 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -10132,18 +10132,20 @@ For portability to different @command{make} implementations, package authors are advised to not set the variable @code{V} inside the @file{Makefile.am} file, to allow the user to override the value for subdirectories as well. -The current implementation of this feature relies on a non-POSIX, but in -practice rather widely supported @file{Makefile} construct of nested -variable expansion @samp{$(@var{var1}$(V))}. Do not use the -@option{silent-rules} option if your package needs to build with -@command{make} implementations that do not support it. The -@option{silent-rules} option turns off warnings about recursive variable -expansion, which are in turn enabled by @option{-Wportability} -(@pxref{Invoking Automake}). +The current implementation of this feature normally uses nested +variable expansion @samp{$(@var{var1}$(V))}, a @file{Makefile} feature +that is not required by POSIX 2008 but is widely supported in +practice. On the rare @command{make} implementations that do not +support nested variable expansion, whether rules are silent is always +determined at configure time, and cannot be overridden at make time. +Future versions of POSIX are likely to require nested variable +expansion, so this minor limitation should go away with time. @vindex @code{AM_V_GEN} @vindex @code{AM_V_at} @vindex @code{AM_DEFAULT_VERBOSITY} +@vindex @code{AM_V} +@vindex @code{AM_DEFAULT_V} To extend the silent mode to your own rules, you have two choices: @itemize @bullet @@ -10159,8 +10161,8 @@ The following snippet shows how you would define your own equivalent of @code{AM_V_GEN}: @example -pkg_verbose = $(pkg_verbose_$(V)) -pkg_verbose_ = $(pkg_verbose_$(AM_DEFAULT_VERBOSITY)) +pkg_verbose = $(pkg_verbose_@@AM_V@@) +pkg_verbose_ = $(pkg_verbose_@@AM_DEFAULT_V@@) pkg_verbose_0 = @@echo PKG-GEN $@@; foo: foo.in diff --git a/m4/silent.m4 b/m4/silent.m4 index 6d2a1a2..8bd931b 100644 --- a/m4/silent.m4 +++ b/m4/silent.m4 @@ -1,11 +1,11 @@ ## -*- Autoconf -*- -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 +# serial 2 # AM_SILENT_RULES([DEFAULT]) # -------------------------- @@ -20,6 +20,36 @@ yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac +dnl +dnl A few `make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using `$V' instead of `$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl diff --git a/tests/Makefile.am b/tests/Makefile.am index 5ac0e48..c1c0c83 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -759,6 +759,7 @@ silent-many-gcc.test \ silent-many-generic.test \ silent-lex-gcc.test \ silent-lex-generic.test \ +silent-nested-vars.test \ silent-yacc-gcc.test \ silent-yacc-generic.test \ silent-configsite.test \ diff --git a/tests/silent-nested-vars.test b/tests/silent-nested-vars.test new file mode 100755 index 0000000..4b0fa3c --- /dev/null +++ b/tests/silent-nested-vars.test @@ -0,0 +1,193 @@ +#!/bin/sh +# Copyright (C) 2011 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 2, 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 silent-rules mode, on 'make' implementations that do not +# support nested variables (Bug#9928, Bug#10237). + +. ./defs || Exit 1 + +set -e + +mkdir sub + +cat >>configure.in <<'EOF' +AM_SILENT_RULES +AM_CONDITIONAL([HAVE_NESTED_VARIABLES], + [expr "x$AM_V" : '.*\$' >/dev/null]) +AC_CONFIG_FILES([sub/Makefile]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_OUTPUT +EOF + +cat > Makefile.am <<'EOF' +# Need generic and non-generic rules. +bin_PROGRAMS = foo bar +bar_CFLAGS = $(AM_CFLAGS) +SUBDIRS = sub + +# Check that AM_V and AM_DEFAULT_V work as advertised. +pkg_verbose = $(pkg_verbose_ <at> AM_V@) +pkg_verbose_ = $(pkg_verbose_ <at> AM_DEFAULT_V@) +pkg_verbose_0 = @echo PKG-GEN $@; + +bin_SCRIPTS = oop +oop: + $(pkg_verbose)echo $@ >$@ + +mostlyclean-local: + rm -f oop + +if HAVE_NESTED_VARIABLES +# Check that the older form (documented in Automake 1.11) works. +older_pkg_verbose = $(older_pkg_verbose_$(V)) +older_pkg_verbose_ = $(older_pkg_verbose_$(AM_DEFAULT_VERBOSITY)) +older_pkg_verbose_0 = @echo OLDER-PKG-GEN $@; + +bin_SCRIPTS += older-oop +older-oop: + $(older_pkg_verbose)echo $@ >$@ +endif +EOF + +cat > sub/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = subdir-objects +# Need generic and non-generic rules. +bin_PROGRAMS = baz bla +bla_CFLAGS = $(AM_CFLAGS) +EOF + +cat > foo.c <<'EOF' +int main () +{ + return 0; +} +EOF +cp foo.c bar.c +cp foo.c sub/baz.c +cp foo.c sub/bla.c + +cat >mymake <<'EOF' +#! /bin/sh +makerules= +LC_ALL=C +export LC_ALL + +case $1 in + -f) + makefile=$2 + case $2 in + -) makerules=`cat` || exit ;; + esac ;; + *) + for makefile in makefile Makefile; do + test -f $makefile && break + done ;; +esac + +if + nested_var_pat='^[^#]*\$([a-zA-Z0-9_]*\$' + case $makefile in + -) printf '%s\n' "$makerules" | grep "$nested_var_pat";; + *) grep "$nested_var_pat" $makefile;; + esac +then + echo >&2 "mymake: $makefile contains nested variables" + exit 1 +fi + +case $makefile in + -) printf '%s\n' "$makerules" | $mymake_MAKE "$@";; + *) exec $mymake_MAKE "$@";; +esac +EOF +chmod a+x mymake +mymake_MAKE=${MAKE-make} +export mymake_MAKE + +# As a sanity check, verify that `mymake' rejects Makefiles that +# use nested variables. +cat > Makefile <<'END' +a = $(b$(c)) +all: + touch bar +END +./mymake && Exit 99 +mv -f Makefile foo.mk +./mymake -f foo.mk && Exit 99 +cat foo.mk | ./mymake -f - && Exit 99 +test -f bar && Exit 99 +sed '/a =/d' foo.mk > Makefile +./mymake && test -f bar || Exit 99 + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +for make in ${MAKE-make} ./mymake; do + ./configure --enable-silent-rules MAKE=$make >enable.out 2>&1 || + { cat enable.out; Exit 1; } + cat enable.out + case $make in + ./mymake) + grep 'AM_V_CC = .*0' Makefile + grep 'checking whether ./mymake supports nested variables... no' \ + enable.out + ;; + esac + + $make >stdout || { cat stdout; Exit 1; } + cat stdout + $EGREP ' (-c|-o)' stdout && Exit 1 + grep 'mv ' stdout && Exit 1 + grep 'CC .*foo\.' stdout + grep 'CC .*bar\.' stdout + grep 'CC .*baz\.' stdout + grep 'CC .*bla\.' stdout + grep 'CCLD .*foo' stdout + grep 'CCLD .*bar' stdout + grep 'CCLD .*baz' stdout + grep 'CCLD .*bla' stdout + grep 'PKG-GEN .*oop' stdout + if test $am_cv_make_support_nested_variables = yes; then + grep 'OLDER-PKG-GEN .*older-oop' stdout + fi + $make clean + + ./configure --disable-silent-rules MAKE=$make >disable.out 2>&1 || + { cat disable.out; Exit 1; } + cat disable.out + case $make in + ./mymake) + grep 'AM_V_CC = .*1' Makefile + grep 'checking whether ./mymake supports nested variables... no' \ + disable.out + ;; + esac + + $make >stdout || { cat stdout; Exit 1; } + cat stdout + grep ' -c' stdout + grep ' -o foo' stdout + grep 'echo .*oop' stdout + if test $am_cv_make_support_nested_variables = yes; then + grep 'echo .*older-oop' stdout + fi + $EGREP '(CC|LD) ' stdout && Exit 1 + $make clean +done + +: -- 1.7.6.4
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Fri, 23 Dec 2011 08:54:02 GMT) Full text and rfc822 format available.Message #57 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: 9928 <at> debbugs.gnu.org, 10237 <at> debbugs.gnu.org, automake-patches <at> gnu.org, skunk <at> iskunk.org Subject: Re: bug#9928: bug#10237: AM_SILENT_RULES does not work with NonStop make Date: Fri, 23 Dec 2011 09:50:46 +0100
[adding automake-patches -- which I should have done before] On 12/22/2011 10:56 PM, Paul Eggert wrote: > On 12/21/11 04:21, Stefano Lattarini wrote: >> Hi Paul, thanks for the respin. My comments and objections are inlined. > > Thanks, I have a patch updated with all those comments in mind. > One followup: > >> AM_AM_DEFAULT_VERBOSITY ? > > I changed that to AM_DEFAULT_V, as that seems to fit into the naming > convention better. > Thanks. A couple of typo reports and cosmetic nits that you might fix right away are inlined. Apart from that, I still have some further nits and suggestions for improvements, but I also think the patch is good enough already, and I don't want to force you to yet another respin. So here's the deal: could you apply the patch *not to maint nor to master*, but to a *new* branch (say `silent-fixes' or `silent-portability') based off of maint, and push that new branch to the public automake repo? We can then address the further nits in the next days by working on that branch, and then merge it back into maint once we're done (that will obviously happen before 1.11.3). > From 939ba315f5e3e5caea0513af20724c35ead86956 Mon Sep 17 00:00:00 2001 > From: Paul Eggert <eggert <at> cs.ucla.edu> > Date: Thu, 22 Dec 2011 13:48:54 -0800 > Subject: [PATCH] silent-rules: fallback for makes without nested vars > > This fixes two problems reported for Automake (Bug#9928, Bug#10237) > and is in response to a bug report for building coreutils on HP > NonStop OS (Bug#10234). The problem is that HP NonStop 'make' > treats a line like "AM_V_CC = $(am__v_CC_$(V))" as one that > expands a macro with the funny name am__v_CC_$(V instead of the > desired name am__v_CC_1 or am__v_CC_0, and since the funny macro > is not defined the line is equivalent to "AM_V_CC = )"; this > inserts a stray ")" when $(AM_V_CC) is used, which eventually > causes 'make' to fail. > > The basic idea is that instead of generating Makefile.in lines like > "AM_V_CC = $(am__v_CC_$(V))", we generate > "AM_V_CC = $(am__v_CC_ <at> AM_V@)". We then AC_SUBST $(V) for @AM_V@ > in the usual case where `make' supports nested variables, > and substitute 1 (or 0) otherwise. Similarly for usages like > $(am__v_CC_$(AM_DEFAULT_VERBOSITY)). > > With this change, make implementations that doesn't grasp nested > variable expansions will still be able to run Makefiles generated > using the silent-rules option. They won't allow the user to > override the make verbosity at runtime through redefinition of > $(V) (as in "make V=0"); but this is still an improvement over not > being able to work at all. > > * NEWS: Document this. > * automake.in (define_verbose_var): When defining the variable, > s/variable/variables/ > use @AM_V@ rather than $(V), and use @AM_DEFAULT_V@ rather than > $(AM_DEFAULT_VERBOSITY). > * doc/automake.texi (Automake silent-rules Option): Explain new system. > * m4/silent.m4 (AM_SILENT_RULES): Check whether `make' supports > nested variables, and substitute AM_V and AM_DEFAULT_V accordingly. > * tests/silent-nested-vars.test: New test. > * tests/Makefile.am (TESTS): Add it. > --- > ChangeLog | 39 ++++++++ > NEWS | 7 ++ > automake.in | 9 ++- > doc/automake.texi | 22 +++-- > m4/silent.m4 | 34 +++++++- > tests/Makefile.am | 1 + > tests/silent-nested-vars.test | 193 +++++++++++++++++++++++++++++++++++++++++ > 7 files changed, 290 insertions(+), 15 deletions(-) > create mode 100755 tests/silent-nested-vars.test > > diff --git a/ChangeLog b/ChangeLog > index 26e4a2d..461dfac 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,42 @@ > +2011-12-22 Paul Eggert <eggert <at> cs.ucla.edu> > + > + silent-rules: fallback for makes without nested vars > + > + This fixes two problems reported for Automake (Bug#9928, Bug#10237) > + and is in response to a bug report for building coreutils on HP > + NonStop OS (Bug#10234). The problem is that HP NonStop 'make' > + treats a line like "AM_V_CC = $(am__v_CC_$(V))" as one that > + expands a macro with the funny name am__v_CC_$(V instead of the > + desired name am__v_CC_1 or am__v_CC_0, and since the funny macro > + is not defined the line is equivalent to "AM_V_CC = )"; this > + inserts a stray ")" when $(AM_V_CC) is used, which eventually > + causes 'make' to fail. > + > + The basic idea is that instead of generating Makefile.in lines like > + "AM_V_CC = $(am__v_CC_$(V))", we generate > + "AM_V_CC = $(am__v_CC_ <at> AM_V@)". We then AC_SUBST $(V) for @AM_V@ > + in the usual case where `make' supports nested variables, > + and substitute 1 (or 0) otherwise. Similarly for usages like > + $(am__v_CC_$(AM_DEFAULT_VERBOSITY)). > + > + With this change, make implementations that doesn't grasp nested > + variable expansions will still be able to run Makefiles generated > + using the silent-rules option. They won't allow the user to > + override the make verbosity at runtime through redefinition of > + $(V) (as in "make V=0"); but this is still an improvement over not > + being able to work at all. > + > + * NEWS: Document this. > + * automake.in (define_verbose_var): When defining the variable, > s/variable/variables/ > + use @AM_V@ rather than $(V), and use @AM_DEFAULT_V@ rather than > + $(AM_DEFAULT_VERBOSITY). > + * doc/automake.texi (Automake silent-rules Option): Explain new system. > + * m4/silent.m4 (AM_SILENT_RULES): Check whether `make' supports > + nested variables, and substitute AM_V and AM_DEFAULT_V accordingly. > + * tests/silent-nested-vars.test: New test. > + * tests/Makefile.am (TESTS): Add it. > + > + > 2011-12-22 Stefano Lattarini <stefano.lattarini <at> gmail.com> > > hacking: distribute it, and mention it in the ChangeLog > diff --git a/NEWS b/NEWS > index db448a9..80ed91e 100644 > --- a/NEWS > +++ b/NEWS > @@ -84,6 +84,13 @@ Bugs fixed in 1.11.0a: > not used, `make' output no longer contains spurious backslash-only > lines, thus once again matching what Automake did before 1.11. > > + - The `silent-rules' option now generates working makefiles even for > + the uncommon `make' implementations that do not support the > + nested-variables extension to POSIX 2008. For such `make' > + implementations, whether a build is silent is determined at > + configure time, and cannot be overridden at make time with `make > + V=0' or `make V=1'. > + Better line wrapping for the last two lines? + configure time, and cannot be overridden at make time with + `make V=0' or `make V=1'. No more nits from now on; quoting rest of the patch for reference. > - The AM_COND_IF macro also works if the shell expression for the conditional > is no longer valid for the condition. > > diff --git a/automake.in b/automake.in > index 309eade..7efb7d5 100644 > --- a/automake.in > +++ b/automake.in > @@ -1161,9 +1161,12 @@ sub define_verbose_var ($$) > my $silent_var = $pvar . '_0'; > if (option 'silent-rules') > { > - # Using `$V' instead of `$(V)' breaks IRIX make. > - define_variable ($var, '$(' . $pvar . '_$(V))', INTERNAL); > - define_variable ($pvar . '_', '$(' . $pvar . '_$(AM_DEFAULT_VERBOSITY))', INTERNAL); > + # For typical `make's, `configure' replaces AM_V (inside @@) with $(V) > + # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY). > + # For strict POSIX 2008 `make's, it replaces them with 0 or 1 instead. > + # See AM_SILENT_RULES in m4/silent.m4. > + define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL); > + define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)', INTERNAL); > Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val, > '', INTERNAL, VAR_ASIS) > if (! vardef ($silent_var, TRUE)); > diff --git a/doc/automake.texi b/doc/automake.texi > index ced1b72..39884af 100644 > --- a/doc/automake.texi > +++ b/doc/automake.texi > @@ -10132,18 +10132,20 @@ For portability to different @command{make} implementations, package authors > are advised to not set the variable @code{V} inside the @file{Makefile.am} > file, to allow the user to override the value for subdirectories as well. > > -The current implementation of this feature relies on a non-POSIX, but in > -practice rather widely supported @file{Makefile} construct of nested > -variable expansion @samp{$(@var{var1}$(V))}. Do not use the > -@option{silent-rules} option if your package needs to build with > -@command{make} implementations that do not support it. The > -@option{silent-rules} option turns off warnings about recursive variable > -expansion, which are in turn enabled by @option{-Wportability} > -(@pxref{Invoking Automake}). > +The current implementation of this feature normally uses nested > +variable expansion @samp{$(@var{var1}$(V))}, a @file{Makefile} feature > +that is not required by POSIX 2008 but is widely supported in > +practice. On the rare @command{make} implementations that do not > +support nested variable expansion, whether rules are silent is always > +determined at configure time, and cannot be overridden at make time. > +Future versions of POSIX are likely to require nested variable > +expansion, so this minor limitation should go away with time. > > @vindex @code{AM_V_GEN} > @vindex @code{AM_V_at} > @vindex @code{AM_DEFAULT_VERBOSITY} > +@vindex @code{AM_V} > +@vindex @code{AM_DEFAULT_V} > To extend the silent mode to your own rules, you have two choices: > > @itemize @bullet > @@ -10159,8 +10161,8 @@ The following snippet shows how you would define your own equivalent of > @code{AM_V_GEN}: > > @example > -pkg_verbose = $(pkg_verbose_$(V)) > -pkg_verbose_ = $(pkg_verbose_$(AM_DEFAULT_VERBOSITY)) > +pkg_verbose = $(pkg_verbose_@@AM_V@@) > +pkg_verbose_ = $(pkg_verbose_@@AM_DEFAULT_V@@) > pkg_verbose_0 = @@echo PKG-GEN $@@; > > foo: foo.in > diff --git a/m4/silent.m4 b/m4/silent.m4 > index 6d2a1a2..8bd931b 100644 > --- a/m4/silent.m4 > +++ b/m4/silent.m4 > @@ -1,11 +1,11 @@ > ## -*- Autoconf -*- > -# Copyright (C) 2009 Free Software Foundation, Inc. > +# Copyright (C) 2009, 2011 Free Software Foundation, Inc. > # > # This file is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. > > -# serial 1 > +# serial 2 > > # AM_SILENT_RULES([DEFAULT]) > # -------------------------- > @@ -20,6 +20,36 @@ yes) AM_DEFAULT_VERBOSITY=0;; > no) AM_DEFAULT_VERBOSITY=1;; > *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; > esac > +dnl > +dnl A few `make' implementations (e.g., NonStop OS and NextStep) > +dnl do not support nested variable expansions. > +dnl See automake bug#9928 and bug#10237. > +am_make=${MAKE-make} > +AC_CACHE_CHECK([whether $am_make supports nested variables], > + [am_cv_make_support_nested_variables], > + [if AS_ECHO([['TRUE=$(BAR$(V)) > +BAR0=false > +BAR1=true > +V=1 > +am__doit: > + @$(TRUE) > +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then > + am_cv_make_support_nested_variables=yes > +else > + am_cv_make_support_nested_variables=no > +fi]) > +if test $am_cv_make_support_nested_variables = yes; then > + dnl Using `$V' instead of `$(V)' breaks IRIX make. > + AM_V='$(V)' > + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' > +else > + AM_V=$AM_DEFAULT_VERBOSITY > + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY > +fi > +AC_SUBST([AM_V])dnl > +AM_SUBST_NOTMAKE([AM_V])dnl > +AC_SUBST([AM_DEFAULT_V])dnl > +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl > AC_SUBST([AM_DEFAULT_VERBOSITY])dnl > AM_BACKSLASH='\' > AC_SUBST([AM_BACKSLASH])dnl > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 5ac0e48..c1c0c83 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -759,6 +759,7 @@ silent-many-gcc.test \ > silent-many-generic.test \ > silent-lex-gcc.test \ > silent-lex-generic.test \ > +silent-nested-vars.test \ > silent-yacc-gcc.test \ > silent-yacc-generic.test \ > silent-configsite.test \ > diff --git a/tests/silent-nested-vars.test b/tests/silent-nested-vars.test > new file mode 100755 > index 0000000..4b0fa3c > --- /dev/null > +++ b/tests/silent-nested-vars.test > @@ -0,0 +1,193 @@ > +#!/bin/sh > +# Copyright (C) 2011 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 2, 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 silent-rules mode, on 'make' implementations that do not > +# support nested variables (Bug#9928, Bug#10237). > + > +. ./defs || Exit 1 > + > +set -e > + > +mkdir sub > + > +cat >>configure.in <<'EOF' > +AM_SILENT_RULES > +AM_CONDITIONAL([HAVE_NESTED_VARIABLES], > + [expr "x$AM_V" : '.*\$' >/dev/null]) > +AC_CONFIG_FILES([sub/Makefile]) > +AC_PROG_CC > +AM_PROG_CC_C_O > +AC_OUTPUT > +EOF > + > +cat > Makefile.am <<'EOF' > +# Need generic and non-generic rules. > +bin_PROGRAMS = foo bar > +bar_CFLAGS = $(AM_CFLAGS) > +SUBDIRS = sub > + > +# Check that AM_V and AM_DEFAULT_V work as advertised. > +pkg_verbose = $(pkg_verbose_ <at> AM_V@) > +pkg_verbose_ = $(pkg_verbose_ <at> AM_DEFAULT_V@) > +pkg_verbose_0 = @echo PKG-GEN $@; > + > +bin_SCRIPTS = oop > +oop: > + $(pkg_verbose)echo $@ >$@ > + > +mostlyclean-local: > + rm -f oop > + > +if HAVE_NESTED_VARIABLES > +# Check that the older form (documented in Automake 1.11) works. > +older_pkg_verbose = $(older_pkg_verbose_$(V)) > +older_pkg_verbose_ = $(older_pkg_verbose_$(AM_DEFAULT_VERBOSITY)) > +older_pkg_verbose_0 = @echo OLDER-PKG-GEN $@; > + > +bin_SCRIPTS += older-oop > +older-oop: > + $(older_pkg_verbose)echo $@ >$@ > +endif > +EOF > + > +cat > sub/Makefile.am <<'EOF' > +AUTOMAKE_OPTIONS = subdir-objects > +# Need generic and non-generic rules. > +bin_PROGRAMS = baz bla > +bla_CFLAGS = $(AM_CFLAGS) > +EOF > + > +cat > foo.c <<'EOF' > +int main () > +{ > + return 0; > +} > +EOF > +cp foo.c bar.c > +cp foo.c sub/baz.c > +cp foo.c sub/bla.c > + > +cat >mymake <<'EOF' > +#! /bin/sh > +makerules= > +LC_ALL=C > +export LC_ALL > + > +case $1 in > + -f) > + makefile=$2 > + case $2 in > + -) makerules=`cat` || exit ;; > + esac ;; > + *) > + for makefile in makefile Makefile; do > + test -f $makefile && break > + done ;; > +esac > + > +if > + nested_var_pat='^[^#]*\$([a-zA-Z0-9_]*\$' > + case $makefile in > + -) printf '%s\n' "$makerules" | grep "$nested_var_pat";; > + *) grep "$nested_var_pat" $makefile;; > + esac > +then > + echo >&2 "mymake: $makefile contains nested variables" > + exit 1 > +fi > + > +case $makefile in > + -) printf '%s\n' "$makerules" | $mymake_MAKE "$@";; > + *) exec $mymake_MAKE "$@";; > +esac > +EOF > +chmod a+x mymake > +mymake_MAKE=${MAKE-make} > +export mymake_MAKE > + > +# As a sanity check, verify that `mymake' rejects Makefiles that > +# use nested variables. > +cat > Makefile <<'END' > +a = $(b$(c)) > +all: > + touch bar > +END > +./mymake && Exit 99 > +mv -f Makefile foo.mk > +./mymake -f foo.mk && Exit 99 > +cat foo.mk | ./mymake -f - && Exit 99 > +test -f bar && Exit 99 > +sed '/a =/d' foo.mk > Makefile > +./mymake && test -f bar || Exit 99 > + > +$ACLOCAL > +$AUTOMAKE --add-missing > +$AUTOCONF > + > +for make in ${MAKE-make} ./mymake; do > + ./configure --enable-silent-rules MAKE=$make >enable.out 2>&1 || > + { cat enable.out; Exit 1; } > + cat enable.out > + case $make in > + ./mymake) > + grep 'AM_V_CC = .*0' Makefile > + grep 'checking whether ./mymake supports nested variables... no' \ > + enable.out > + ;; > + esac > + > + $make >stdout || { cat stdout; Exit 1; } > + cat stdout > + $EGREP ' (-c|-o)' stdout && Exit 1 > + grep 'mv ' stdout && Exit 1 > + grep 'CC .*foo\.' stdout > + grep 'CC .*bar\.' stdout > + grep 'CC .*baz\.' stdout > + grep 'CC .*bla\.' stdout > + grep 'CCLD .*foo' stdout > + grep 'CCLD .*bar' stdout > + grep 'CCLD .*baz' stdout > + grep 'CCLD .*bla' stdout > + grep 'PKG-GEN .*oop' stdout > + if test $am_cv_make_support_nested_variables = yes; then > + grep 'OLDER-PKG-GEN .*older-oop' stdout > + fi > + $make clean > + > + ./configure --disable-silent-rules MAKE=$make >disable.out 2>&1 || > + { cat disable.out; Exit 1; } > + cat disable.out > + case $make in > + ./mymake) > + grep 'AM_V_CC = .*1' Makefile > + grep 'checking whether ./mymake supports nested variables... no' \ > + disable.out > + ;; > + esac > + > + $make >stdout || { cat stdout; Exit 1; } > + cat stdout > + grep ' -c' stdout > + grep ' -o foo' stdout > + grep 'echo .*oop' stdout > + if test $am_cv_make_support_nested_variables = yes; then > + grep 'echo .*older-oop' stdout > + fi > + $EGREP '(CC|LD) ' stdout && Exit 1 > + $make clean > +done > + > +: Thanks, Stefano
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Sun, 25 Dec 2011 18:08:02 GMT) Full text and rfc822 format available.Message #60 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Stefano Lattarini <stefano.lattarini <at> gmail.com> Cc: 9928 <at> debbugs.gnu.org, 10237 <at> debbugs.gnu.org, automake-patches <at> gnu.org, skunk <at> iskunk.org Subject: Re: bug#9928: bug#10237: AM_SILENT_RULES does not work with NonStop make Date: Sun, 25 Dec 2011 10:04:59 -0800
On 12/23/11 00:50, Stefano Lattarini wrote: > could you apply the patch *not to maint nor to master*, but to a *new* > branch (say `silent-fixes' or `silent-portability') based off of maint, > and push that new branch to the public automake repo? OK, done, as 'silent-fixes', with your recent nit-fixes applied. Here's a URL for anyone else who wants to follow along: http://git.savannah.gnu.org/cgit/automake.git/log/?h=silent-fixes
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Mon, 26 Dec 2011 17:46:02 GMT) Full text and rfc822 format available.Message #63 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: 9928 <at> debbugs.gnu.org, 10237 <at> debbugs.gnu.org, automake-patches <at> gnu.org, skunk <at> iskunk.org Subject: Re: bug#10237: bug#9928: bug#10237: AM_SILENT_RULES does not work with NonStop make Date: Mon, 26 Dec 2011 18:42:35 +0100
[Message part 1 (text/plain, inline)]
tags 10237 + patch tags 9928 + patch thanks On 12/25/2011 07:04 PM, Paul Eggert wrote: > On 12/23/11 00:50, Stefano Lattarini wrote: >> could you apply the patch *not to maint nor to master*, but to a *new* >> branch (say `silent-fixes' or `silent-portability') based off of maint, >> and push that new branch to the public automake repo? > > OK, done, as 'silent-fixes', with your recent nit-fixes applied. > > Here's a URL for anyone else who wants to follow along: > > http://git.savannah.gnu.org/cgit/automake.git/log/?h=silent-fixes > Thanks. And here is the follow-up tweaking for the test cases I had promised. I will push in a couple of days if there is no objection. Thanks, Stefano
[0001-tests-tweak-tests-on-silent-rules-for-makes-without-.patch (text/x-diff, attachment)]
Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Mon, 26 Dec 2011 17:46:02 GMT) Full text and rfc822 format available.bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Mon, 26 Dec 2011 18:12:03 GMT) Full text and rfc822 format available.Message #68 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Stefano Lattarini <stefano.lattarini <at> gmail.com> Cc: 9928 <at> debbugs.gnu.org, 10237 <at> debbugs.gnu.org, automake-patches <at> gnu.org, skunk <at> iskunk.org Subject: Re: bug#10237: bug#9928: bug#10237: AM_SILENT_RULES does not work with NonStop make Date: Mon, 26 Dec 2011 10:09:15 -0800
On 12/26/11 09:42, Stefano Lattarini wrote: > And here is the follow-up tweaking for the test cases I had > promised. I will push in a couple of days if there is no objection. Thanks, that looks good to me; please push it as soon as you like.
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Mon, 26 Dec 2011 21:39:02 GMT) Full text and rfc822 format available.Message #71 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: 9928 <at> debbugs.gnu.org, 10237 <at> debbugs.gnu.org, automake-patches <at> gnu.org, skunk <at> iskunk.org Subject: Re: AM_SILENT_RULES does not work with NonStop make Date: Mon, 26 Dec 2011 22:35:27 +0100
On 12/26/2011 07:09 PM, Paul Eggert wrote: > On 12/26/11 09:42, Stefano Lattarini wrote: >> And here is the follow-up tweaking for the test cases I had >> promised. I will push in a couple of days if there is no objection. > > Thanks, that looks good to me; please push it as soon as you like. > Done. I plan to merge the 'silent-fixes' branch back into maint as soon as I (or someone else ;-) have done more extensive testsuite runs and/or on-field testing on non-Linux systems (*BSD and Solaris at least, hopefully also Cygwin or MinGW). If someone could also test the patches on a NonStop and/or NextStep system, that would be great. Thanks, Stefano
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Wed, 28 Dec 2011 20:12:02 GMT) Full text and rfc822 format available.Message #74 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Stefano Lattarini <stefano.lattarini <at> gmail.com> Cc: 9928 <at> debbugs.gnu.org, 10237 <at> debbugs.gnu.org, automake-patches <at> gnu.org, skunk <at> iskunk.org Subject: Re: AM_SILENT_RULES does not work with NonStop make Date: Wed, 28 Dec 2011 12:08:44 -0800
On 12/26/11 13:35, Stefano Lattarini wrote: > testing on non-Linux systems (*BSD and Solaris at least, hopefully also > Cygwin or MinGW). I tested it on Solaris 8 and that test worked fine. I used Autoconf 2.63, GNU m4 1.4.13, and the system-supplied 'make'. Some of the other tests failed, e.g., because I didn't have Fortran installed, but I didn't investigate them; it hardly seems worth the trouble for such an old system.
bug-automake <at> gnu.org
:bug#9928
; Package automake
.
(Wed, 28 Dec 2011 20:23:03 GMT) Full text and rfc822 format available.Message #77 received at 9928 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: 9928 <at> debbugs.gnu.org, 10237 <at> debbugs.gnu.org, automake-patches <at> gnu.org, skunk <at> iskunk.org Subject: Re: bug#9928: AM_SILENT_RULES does not work with NonStop make Date: Wed, 28 Dec 2011 21:19:23 +0100
Hi Paul. On 12/28/2011 09:08 PM, Paul Eggert wrote: > On 12/26/11 13:35, Stefano Lattarini wrote: >> testing on non-Linux systems (*BSD and Solaris at least, hopefully also >> Cygwin or MinGW). > > I tested it on Solaris 8 and that test worked fine. > I used Autoconf 2.63, GNU m4 1.4.13, and the system-supplied 'make'. > > Some of the other tests failed, e.g., because I didn't have > Fortran installed, but I didn't investigate them; it hardly > seems worth the trouble for such an old system. > > I did some testing on Debian unstable, Solaris 10, NetBSD 5.1 and Cygwin 1.5 (in part by running the relevant test cases from the automake testsuite, in part trying out the build system of GNU coreutils). Everything seems fine so far. I want to do some small improvements to the documentation, then I say we are ready to merge the 'silent-fixes' branch into maint. Regards, Stefano
Stefano Lattarini <stefano.lattarini <at> gmail.com>
:"Daniel Richard G." <skunk <at> iSKUNK.ORG>
:Message #82 received at 9928-done <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: 10237-done <at> debbugs.gnu.org, automake-patches <at> gnu.org, 9928-done <at> debbugs.gnu.org, skunk <at> iskunk.org Subject: Re: bug#10237: bug#9928: AM_SILENT_RULES does not work with NonStop make Date: Fri, 30 Dec 2011 13:50:04 +0100
On 12/28/2011 09:19 PM, Stefano Lattarini wrote: > > I did some testing on Debian unstable, Solaris 10, NetBSD 5.1 and Cygwin 1.5 (in > part by running the relevant test cases from the automake testsuite, in part > trying out the build system of GNU coreutils). Everything seems fine so far. > I want to do some small improvements to the documentation, then I say we are > ready to merge the 'silent-fixes' branch into maint. > I've just re-read Paul's changes to the manual, and on a second thought, I think they are definitely good enough as they are. I've thus merged the 'silent-fixes' branch into maint, and pushed. I'm thus closing the bugs #9928 and #10237. Thanks, Stefano
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Sat, 28 Jan 2012 12:24:02 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.