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.
Asked
Active
Viewed 650 times
3 Answers
3
Is Prettify Automake what you want?
Edit: As of Automake 1.10b, silent-rules is built-in. Not the same code or style but similar in effect.

ephemient
- 198,619
- 38
- 280
- 391
-
Your link appears to be broken, and I can find barely any mention of "prettify automake" anywhere. – Jack Kelly Oct 27 '10 at 03:44
-
@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 Oct 27 '10 at 04:10
-
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 Oct 27 '10 at 04:19
3
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
- 204,365
- 48
- 270
- 300
-
1Using `AM_SILENT_RULES([yes])` will enable silent rules by default (although you can turn it off with `make V=1`). – Jack Kelly Oct 27 '10 at 03:41
-
@Jack Kelly: That's perfect! I added AM_SILENT_RULES([yes]) to my configure.ac and now the output during compilation looks just like the Linux kernel. – Malvineous Apr 02 '11 at 08:33
1
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
- 10,562
- 23
- 99
- 147
-
Thanks. Can you point me in the direction of the script and how to integrate it into the autotools chain? – Alex Dec 28 '09 at 18:54
-
Ok, for instance make_command | sed
can remove lines that start with (contain) "cp" and "mv" http://www.unix.com/shell-programming-scripting/31181-delete-line-file-sed.html Also to remove everything except for what you need: http://nixcraft.com/shell-scripting/158-using-sed-delete-everything-except-needed-patterns.html Finally ... 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/.../x This should get you started. Qs? – Hamish Grubijan Dec 28 '09 at 19:08 -
Having a python script would make it more readable and more flexible. http://code.activestate.com/recipes/437932/ – Hamish Grubijan Dec 28 '09 at 19:10