buildgcc: Add option to use ccache

This mimicks abuild: -y enables ccache.

Change-Id: I3ac1f809729af816efbc64f5789ab430e1a6a6b2
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/400
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Patrick Georgi 2011-11-04 21:37:14 +01:00 committed by Stefan Reinauer
parent 4a5c62cf91
commit c1a75b13c3
1 changed files with 8 additions and 2 deletions

View File

@ -126,6 +126,7 @@ myhelp()
printf " [-h|--help] print this help and exit\n" printf " [-h|--help] print this help and exit\n"
printf " [-c|--clean] remove temporary files before build\n" printf " [-c|--clean] remove temporary files before build\n"
printf " [-t|--savetemps] don't remove temporary files after build\n" printf " [-t|--savetemps] don't remove temporary files after build\n"
printf " [-y|--ccache] Use ccache when building cross compiler\n"
printf " [-j|--jobs <num>] run <num> jobs in parallel in make\n" printf " [-j|--jobs <num>] run <num> jobs in parallel in make\n"
printf " [-p|--platform <platform>] target platform to build cross compiler for\n" printf " [-p|--platform <platform>] target platform to build cross compiler for\n"
printf " (defaults to $TARGETARCH)\n" printf " (defaults to $TARGETARCH)\n"
@ -167,11 +168,11 @@ getopt - > /dev/null 2>/dev/null || gcc -o getopt getopt.c
getoptbrand="`getopt -V | sed -e '1!d' -e 's,^\(......\).*,\1,'`" getoptbrand="`getopt -V | sed -e '1!d' -e 's,^\(......\).*,\1,'`"
if [ "${getoptbrand}" = "getopt" ]; then if [ "${getoptbrand}" = "getopt" ]; then
# Detected GNU getopt that supports long options. # Detected GNU getopt that supports long options.
args=`getopt -l version,help,clean,directory:,platform:,jobs:,destdir:,savetemps,skip-gdb Vhcd:p:j:D:tG -- "$@"` args=`getopt -l version,help,clean,directory:,platform:,jobs:,destdir:,savetemps,skip-gdb,ccache Vhcd:p:j:D:tGy -- "$@"`
eval set "$args" eval set "$args"
else else
# Detected non-GNU getopt # Detected non-GNU getopt
args=`getopt Vhcd:p:j:D:tG $*` args=`getopt Vhcd:p:j:D:tGy $*`
set -- $args set -- $args
fi fi
@ -192,6 +193,7 @@ while true ; do
-j|--jobs) shift; JOBS="-j $1"; shift;; -j|--jobs) shift; JOBS="-j $1"; shift;;
-G|--gdb) shift; SKIPGDB=0;; -G|--gdb) shift; SKIPGDB=0;;
-S|--scripting) shift; SKIPPYTHON=0;; -S|--scripting) shift; SKIPPYTHON=0;;
-y|--ccache) shift; USECCACHE=1;;
--) shift; break;; --) shift; break;;
-*) printf "Invalid option\n\n"; myhelp; exit 1;; -*) printf "Invalid option\n\n"; myhelp; exit 1;;
*) break;; *) break;;
@ -325,6 +327,10 @@ if [ `uname` = "Darwin" ]; then
fi fi
fi fi
if [ "$USECCACHE" = 1 ]; then
CC="ccache $CC"
fi
mkdir -p build-gmp build-mpfr build-mpc build-libelf build-binutils \ mkdir -p build-gmp build-mpfr build-mpc build-libelf build-binutils \
build-gcc build-python build-expat build-gcc build-python build-expat
if [ $SKIPGDB -eq 0 ]; then if [ $SKIPGDB -eq 0 ]; then