tags:

views:

69

answers:

3

I am using GNU autoconf/automake. Is there any way I can control what make prints to stdout from configure.ac or Makefile.am? For example, suppress mv and cp commands being printed out to the screen, only print the name of the file being compiled by gcc rather than the whole command line, highlight gcc warnings in some way.

+1  A: 

I believe the easiest thing is to write a wrapper script which runs *make and parses the output. I believe I have seen this being done in Ubuntu somewhere ...

Hamish Grubijan
Thanks. Can you point me in the direction of the script and how to integrate it into the autotools chain?
Alex
Ok, for instance make_command | sed <sed_flags> can remove lines that start with (contain) "cp" and "mv"http://www.unix.com/shell-programming-scripting/31181-delete-line-file-sed.htmlAlso to remove everything except for what you need:http://nixcraft.com/shell-scripting/158-using-sed-delete-everything-except-needed-patterns.htmlFinally ... highliting ... you just mean prepending something like [WARNING] whenever you see a warning, right?If you sed one-liner starts to look lengthy, then turn it into a script named x and execute: mymake | /path/.../xThis should get you started. Qs?
Hamish Grubijan
Having a python script would make it more readable and more flexible. http://code.activestate.com/recipes/437932/
Hamish Grubijan
+3  A: 
ephemient
Your link appears to be broken, and I can find barely any mention of "prettify automake" anywhere.
Jack Kelly
@Jack Kelly: Huh, it seems to have dropped off the face of the Internet. The Web Archive has an old copy here: http://web.archive.org/web/20080416194543/http://kim.tensta.gannert.se/projects/pretty-am/
ephemient
The archive has links to the patches, so have a +1. However, automake's now up to version 1.11 and has silent-rules support built in, so it's obsolete now.
Jack Kelly
+2  A: 

Modern Automake (after in 1.10b) supports --silent-rules which will suppress the full compile command. (eg, output is "CC foo" instead of "gcc -DHAVE_CONFIG_H ...") That may be all you need. You need to add "silent-rules" to AM_INIT_AUTOMAKE and pass --enable-silent-rules to configure (or put it in CONFIG_SITE) to enable the feature. See the automake docs for details.

William Pursell
Using `AM_SILENT_RULES([yes])` will enable silent rules by default (although you can turn it off with `make V=1`).
Jack Kelly