Making output of make more beautiful

2009-06-10 Thread Vincent Torri


Hey,

automake provides a way to replace the command line generated in a 
Makefile by


GEN output-file

Is it possible to add 2 features :

1) adding a percentage at the beginning of the line
2) displaying the lines with a color according to what is done 
(compilation, execution or error)


?

(a bit like cmake or waf do)

Thank you

Vincent Torri




Re: Making output of make more beautiful

2009-06-10 Thread Paul Smith
On Wed, 2009-06-10 at 14:04 +0200, Vincent Torri wrote:
 Is it possible to add 2 features :
 
 1) adding a percentage at the beginning of the line

People often ask for this, but it's not possible: a percentage of what?
The way make works, it has absolutely no idea how much work there is
left to do.  Make does not plan out all the operations it needs to run,
then start working on them: rather, it knows what it wants to build and
it works on it one step at a time until there are no more steps to take.
But when it's working on step 5 it has no idea if there is one step
left, or 100.  So computing a percent complete cannot be done.

Certainly there's no way automake can do this.

 2) displaying the lines with a color according to what is done 
 (compilation, execution or error)

Today, make does no processing on the output of the commands it invokes:
they just write directly to stdout, so colorizing error or warning
messages by make is not possible.  This feature could conceivably be
added (in fact, there are even more legitimate reasons for make to
process job output than colorization: when make invokes parallel builds
the output from the parallel jobs is today all jumbled together which
makes it difficult to read: there are enhancement requests to allow the
output to be buffered then displayed all at once when the command
completes).

The colorization of different types of rules (rather than output) is
most easily accomplished by automake, by adding that directly to the
output.

However, both of these could also be, and are perhaps most easily,
accomplished via an extra colorization tool, where the output of make
is piped into this tool which reads stdin, colorizes it, then displays
it.  This saves a lot of effort and change in make and automake and
provides a clean and much more easily modifiable colorization
environment.

-- 
---
 Paul D. Smith psm...@gnu.org  Find some GNU make tips at:
 http://www.gnu.org  http://make.mad-scientist.us
 Please remain calm...I may be mad, but I am a professional. --Mad Scientist




Re: Making output of make more beautiful

2009-06-10 Thread Ralf Wildenhues
Hello Paul, Vincent,

* Paul Smith wrote on Wed, Jun 10, 2009 at 02:22:51PM CEST:
 On Wed, 2009-06-10 at 14:04 +0200, Vincent Torri wrote:
  Is it possible to add 2 features :
  
  1) adding a percentage at the beginning of the line
 
 People often ask for this, but it's not possible: a percentage of what?

I'll play devil's advocate on this one.

You can communicate to the toplevel `make' invocation, in the same
manner as the job server, the number of targets considered and the
number of sub-makes invoked.  That won't give you a percentage, of
course, as neither needs to be constant over two `make' invocations
nor with different MAKECMDGOALS.  But these two numbers can give a
rough estimate on the progress.

  2) displaying the lines with a color according to what is done 
  (compilation, execution or error)

 The colorization of different types of rules (rather than output) is
 most easily accomplished by automake, by adding that directly to the
 output.

Yes; and in fact, Automake 1.11 has the option 'color-tests' which can
cause the output of 'make check' to be colorized, if you use the builtin
test driver (i.e., TESTS = ...).

For normal build rules, I would go this way only with another option,
and only if there was a useful and easy semantics for this colorization.

For highlighting compiler warnings, I'd just try out the 'silent-rules'
Automake option (Linux kernel-style build output).

 However, both of these could also be, and are perhaps most easily,
 accomplished via an extra colorization tool, where the output of make
 is piped into this tool which reads stdin, colorizes it, then displays
 it.  This saves a lot of effort and change in make and automake and
 provides a clean and much more easily modifiable colorization
 environment.

Of course; and in fact, editors have been doing this task very well for
years already.  But now that we're already on our way to the dark side,
see above, it's even more difficult to convince users that it's the
wrong path.  ;-)

Cheers,
Ralf