patch: purdy colours for makefiles

Here is a patch to add colour to build output (make) for LLVM sources.
Feedback and ideas welcome.

The patch replaces $(Echo) usage in some key rules in Makefile.rules
with $(Banner) which invokes a new script utils/make-banner.sh which
is capable of adding appropriate ANSI escape sequences.

step1: apply patch
step2: chmod 755 utils/make-banner.sh
step3: export MAKE_BANNER_ANSI=1

Next, you must have an xterm or an ANSI capable terminal advertising
itself via $TERM and matching substring 'xterm'. Now simply set your env
and make:

  export MAKE_BANNER_ANSI=1
  make

SOME EXAMPLES:
  export MAKE_BANNER_ANSI=1
  utils/make-banner.sh -help
  utils/make-banner.sh Hello -bold world.
  utils/make-banner.sh -prefix "llvm[99]:" -bold M4 processing -in file.txt.m4 "->" -out file.txt

PERFORMANCE CONSIDERATIONS
- total lines of make output to build llvm+clang: 1330
- sub-shell echo rate: ~1485 lines/second
- sub-shell make-banner.sh rate: ~267 lines/second

Build speed comparison. Host environment:
- Mac OS X 10.6.2, gcc-4.2, 8 core host
- build llvm + clang (debug)
- llvm and clang trunk@96719
- timing command: time make -j8 (times shown are in seconds, USER SYSTEM ELAPSED)

BEFORE PATCH:

time make -j8

  pass1. 1384.373u 226.969s 4:22.87 612.9%
  pass2. 1385.766u 227.542s 4:18.40 624.3%
  pass3. 1379.234u 224.674s 4:17.56 622.7%

AFTER PATCH:

setenv MAKE_BANNER_ANSI=1
time make -j8

  pass1. 1387.113u 228.287s 4:20.97 618.9%
  pass2. 1389.143u 228.544s 4:20.58 620.7%
  pass3. 1386.785u 228.141s 4:20.37 620.2%

--kb

835091.txt (16.2 KB)

Colors may be purdy, but those echo lines aren't really all that interesting. They're a progress bar in a build system which doesn't otherwise do progress bars. I'd prefer to save color for output which is more likely to warrant attention, such as compiler diagnostics.

Thanks,

Dan