| 1 |
#!/bin/bash |
| 2 |
# |
| 3 |
# Wrapper around make, to colorize it's output and pipe through less. |
| 4 |
# Jumps to the first gcc error that occurs during the build process. |
| 5 |
# |
| 6 |
# Run with --short as the first argument to shorten each line so it fits |
| 7 |
# on the screen. |
| 8 |
# |
| 9 |
|
| 10 |
if [ "$TERM" = "dumb" ];then |
| 11 |
# As suggested by Alexander Korkov ... |
| 12 |
exec make "$@" |
| 13 |
fi |
| 14 |
|
| 15 |
# Do we want truncated output? |
| 16 |
if [ "$1" = "--short" ]; then |
| 17 |
SIZE=$(stty size) |
| 18 |
shift |
| 19 |
else |
| 20 |
SIZE="" |
| 21 |
fi |
| 22 |
if [ "$(basename $0 |cut -f2 -d-)" = "short" ]; then |
| 23 |
SIZE=$(stty size) |
| 24 |
fi |
| 25 |
|
| 26 |
# Pipe through less only if we are invoked as clmake. |
| 27 |
if [ "$(basename $0 |cut -f1 -d-)" = "clmake" ]; then |
| 28 |
if [ -z "${CLMAKE_OPTS}" ]; then |
| 29 |
CLMAKE_OPTS='-SR -pError' |
| 30 |
fi |
| 31 |
make "$@" 2>&1 | colormake.pl $SIZE |less ${CLMAKE_OPTS} |
| 32 |
else |
| 33 |
make "$@" 2>&1 | colormake.pl $SIZE |
| 34 |
fi |
| 35 |
|
| 36 |
# Thanks to Alexander Korkov and Kolan Sh |
| 37 |
exit ${PIPESTATUS[0]} |