Subject: Re: bug#8665: automake should offer APIs to honour silent-rules verbosity from shell code in Makefiles

From: Stefano Lattarini <[email-masked]>
Date: Sun, 22 Apr 2012 17:05:20 +0200

Reviving and oldish bug report (and CC:ing the Automake list now).

Reference: <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8665>

I wrote:
>
> A relevant excerpt [from the manual]:
>
>  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 PKG-GEN $@;
>     foo: foo.in
>         (pkg_verbose)cp $(srcdir)/foo.in $@

Jack Kelly replied:
>
> Yes. I think it would be nice to make a Makefile.am declaration or m4
> macro to generate this,

To which I replied:
>
> I agree.  The above idiom seems easy enough to automatize.  I'm not sure
> what the best syntax for this new feature would be, tough.

It could be something as simple as this maybe:

  AM_QUIET_PKG = PKG-GEN

which would output in the generated Makefile.in:

  AM_V_PKG = $(pkg_verbose_@AM_V@)
  am__V_PKG_ = $(pkg_verbose_@AM_DEFAULT_V@)
  am__V_PKG_0 = @echo $(AM_QUIET_PKG) $@;

so that an usage like:

  foo: foo.in
          $(AM_V_PKG)cp $(srcdir)/foo.in $@

in Makefile.am will produce at runtime:

  $ make foo V=0
  PKG-GEN foo

  $ make foo V=1
  cp ./foo.in foo

WDYT?

Regards,
  Stefano