On 7 June 2013 23:10, Gavin Smith <gavinsmith0...@gmail.com> wrote: > On Fri, Jun 7, 2013 at 2:55 PM, Darren Garvey <darren.gar...@gmail.com> > wrote: > > Hi all, > > > > I've been trying to make a large automake-generated project I work on > build > > quieter. While there is some support for "silent-rules", there are > several > > places where automake templates* don't silence themselves, which I'd like > > to rectify. > > > > I have made several changes locally which helps a lot and I'd like to > > prepare a patch. Since I've not hacked on automake before I may need some > > guidance on conventions as not all of them are obvious to me. > > > > To make a rule conditionally silent, I use $(AM_V_at) in _my_ projects, > but > > automake sources itself have %SILENT% which seems to be equivalent, IIUC. > > Is %SILENT% preferred? > > > My understanding is as follows. Strings like %SILENT% are substituted > in the templates by the "file_contents" function, and probably end up > as "$(AM_V_at)". See the "silent_flag" function. I think it would be > better to use %SILENT% for consistency. There is also the %VERBOSE% > automake-time substitution, but this expands to something different > for every language (e.g. "$(AM_V_CC)"). >
%SILENT% doesn't work in any of the places I tried. I'm speculating that this is because it's substituted too early. I see it being used in a few places (eg. lib/am/library.am), but those rules are full of other %NAME% strings. I'm seeing some test failures, using v1.11, but these seem unrelated to my changes. The v1.13 release notes talk about possible spurious test failures, but I'm getting 9 test failures on Fedora 18. I'll check with the latest release. > The HACKING file says: > > > >> * For install and uninstall rules, if a loop is required, it should be > >> silent. Then the body of the loop itself should print each > "important" > >> command it runs. The printed commands should be preceded by a single > >> space. > > > > This means there are several places in the templates that have a long > > multi-line rule that is itself silent, but includes one or more "echo"s. > > One idea was to define a local function such as: > > > > am_echo() { echo "$@" >/dev/null; } > > > > and then define $(AM_V_echo) that conditionally used either "echo" or > > "am_echo". This feels a bit ugly but it should be minimally intrusive. > > Perhaps there's a more canonical way to do this using some existing > > automake feature. I imagine anyone working on the silent-rules support > may > > have already thought about this and may have a superior alternative > > suggestion.... > How about setting AM_V_echo to either "echo" or something like "true", > and writing "$(AM_V_echo) whatever" instead of "echo whatever", if > this is desired? > Aha! I didn't realise "true" could take arguments. I'll try that and see if it works. Thanks. I'll bake up a patch. Cheers, Darren