Source

dotfiles / install-colorgcc.sh

#!/bin/sh -e

DESTDIR="$1"
[ -n "$DESTDIR" -a -d "$DESTDIR" ] \
    || { echo "please specify destdir" >&2; exit 1; }

TARGET="$(which colorgcc 2>/dev/null || true)"
[ -n "$TARGET" ] || { echo "no colorgcc found" >&2; exit 0; }

echo_exec () {
    echo "$@"
    "$@"
}

for name in cc c++ gcc g++; do
    [ -e "$DESTDIR/$name" ] || echo_exec ln -s "$TARGET" "$DESTDIR/$name"
done