Pretty Make

From Freehackers
Jump to: navigation, search

Obsolescence

Pretty Make has become obsolete because KDE compilation infrastructure has been replaced by CMake.

The program still works and could be used as a basis for beautifying other kinds of output.

Introduction

Pretty make is a very small python script that will organise and colorize your make output. I have written this because when compiling, I was sick of the endless lines of uninteresting options, which were hiding the gcc options I was looking for.

The program analyses its specific options then runs make with all the other options. So it is compatible with make. I use it every week to compile KDE with:

 alias make='pretty_make.py'. 

People have been wondering about CPU usage. Starting the python interpreter takes a little CPU, but this is before you have started your compilation, so you sill have plenty of CPU anyway. The python interpreter is started only once for a make command, so it won't matter much in you overall compilation speed.

Now, the parsing of the line uses builting python functions, which are written in C. So this is fast and there is really not a lot of work: split the line, compare beginning of words, fill lists, display. And such a line is displayed when gcc choose a new file to compile, so the tiny amount of CPU taken would have probably not been used anyway (except if you use -j12) because gcc was still loading the files at that time. When I compile, python doesn't make into 'top', so it effectively does not take CPU.


Features

All features are of course configurable.

  • Adapt the output to your terminal width
  • Hide libtool lines: the next line is the real compile line anyway.
  • Group similar options on separate lines: all -D together, all -I together, ...
  • Can hide uninteresting option: you get <-W> instead of all the -W options.
  • Colorize options differently: makes it easier to distinguish between -L, -I and -D
  • Colorize moc and uic lines differently: else, you tend to miss them even when looking for them
  • Enable or disable colors
  • Post-process your compilation output: compile with output to a file and beautify it later.
  • Useable inside vim and probably other editors
  • All options configurable

The default options you might want to alter are at the beginning of the program. There is no need to know python to modify them.

Screenshot

Before:

pretty-make-before.png

After:

pretty-make-after.png

Download

Version 1.3 : 20 july 2003

New features:

  • add more compiler names
  • add a debug option
  • handles properly argument with spaces inside
  • can now compile kernel without problems

Download: pretty_make.py

Version 1.2 : 02 april 2002

New features:

  • Argument -- passes all the remaining arguments to make (pretty-make.py -- --help yields make's help)
  • Transparancy in konsole is preserved when not altering background color.
  • Fix for arguments of type "arg=foo" that were not passed to make
  • Fix for keyboard interruption (^C) would leave the make running wild in the background


Version 1.1 : 26 march 2002

New features:

  • Fixes for tcsh users


Version 1.0 : 26 march 2002

Initial release.


Get the code

This project is using mercurial to handle the source code.

You can get the latest package/tarball from

You can browse the code online (and make diff or take snapshots)

If you're familiar with source control, you can get the code by cloning the mercurial repository (And hence you'll be able to update later on) using the following command (or your favorite mercurial UI client in Windows/MacOS)

 hg clone http://sources.freehackers.org/Pretty-make

and then update it using

 hg pull -u

Usage

Many way to use it:

  • Adapt the output to your terminal width
  • Hide libtool lines: the next line is the real compile line anyway.
  • Group similar options on separate lines: all -D together, all -I together, ...
  • Can hide uninteresting option: you get <-W> instead of all the -W options.
  • Colorize options differently: makes it easier to distinguish between -L, -I and -D
  • Colorize moc and uic lines differently: else, you tend to miss them even when looking for them
  • Enable or disable colors
  • Post-process your compilation output: compile with output to a file and beautify it later.
  • Useable inside vim and probably other editors
  • All options configurable


Red Hat users, be warned: pretty make won't run on your system, because recent Red Hat distributions ship with an old version of python, Python 1.5.2, which is not supported by pretty_make. It is amazing that RedHat ships with such an old version of python. It is now three years old and python has seen 8 stable releases since 1.5.2. This is one more reason for me not to use RedHat. Mandrake and Suse don't have this problem, and I think Debian doesn't too. If you want to run pretty_make, you need to upgrade your version of python.

Feedback

Suggestions, patch, I am open to feedback. Contact me

Report your bugs here.

Other similar programs

Pretty make doesn't use these program but you may want to check them if you like coloured output.

Other software by Philippe Fremy

  • LuaUnit: A unit-testing framework for the Lua language
  • Klotski: a mind-breaking game
  • Indent Finder: analyse source code indentation to set your editor automatically
  • PyTiCroque: a software to help playing at www.croquemonster.com