File: colormake

package info (click to toggle)
colormake 0.9.20140504-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 180 kB
  • sloc: perl: 101; sh: 64; makefile: 11; cpp: 5
file content (37 lines) | stat: -rwxr-xr-x 935 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#
# Wrapper around make, to colorize it's output and pipe through less.
# Jumps to the first gcc error that occurs during the build process.
#
# Run with --short as the first argument to shorten each line so it fits
# on the screen.
#

if [ "$TERM" = "dumb" ];then
   # As suggested by Alexander Korkov ...
   exec make "$@"
fi

# Do we want truncated output?
if [ "$1" = "--short" ]; then
    SIZE=$(stty size)
    shift
else
    SIZE=""
fi
if [ "$(basename $0 |cut -f2 -d-)" = "short" ]; then
    SIZE=$(stty size)
fi

# Pipe through less only if we are invoked as clmake.
if [ "$(basename $0 |cut -f1 -d-)" = "clmake" ]; then
    if [ -z "${CLMAKE_OPTS}" ]; then
        CLMAKE_OPTS='-SR -pError'
    fi
    make "$@" 2>&1 | /usr/share/colormake/colormake.pl $SIZE |less ${CLMAKE_OPTS}
else
    make "$@" 2>&1 | /usr/share/colormake/colormake.pl $SIZE
fi

# Thanks to Alexander Korkov and Kolan Sh
exit ${PIPESTATUS[0]}