Monday, 9 November 2009

makefilter: Colour for make output

I wrote a Python program today which runs make (and passes command-line arguments to it) and filters the output, adding ANSI/VT100 colour codes to highlight certain parts.

The goal was twofold; to distinguish different parts of the gcc / g++ command, and to distinguish commands from error messages and other output lines.

The highlighting is performed by directly emitting the VT100 control sequences. Eventually I might change this to use ncurses / terminfo / something more portable, but for now this will have to do.

There's a webpage relating to the program at http://www.warwick.ac.uk/~phrebd/makefilter.html and a screenshot below (the same screenshot as on the webpage!)


I'm aware of several other projects to achieve similar effects. The closest is pretty_make.py, available at http://phil.freehackers.org/pretty-make/index.html. There is also colorgcc, http://schlueters.de/colorgcc.html, which does a similar thing for gcc error messages (the down side is it's written in Perl).

Update: Version 1.3 of makefilter has been released today (Saturday November 14, 2009). This includes a few minor improvements and bugfixes. The screenshot above has also been updated accordingly.

0 comments:

Post a Comment