2014-04-11 18:50:12 +02:00
|
|
|
#!/bin/sh
|
2015-03-02 22:56:35 +01:00
|
|
|
ROOT=`pwd`
|
2014-04-11 18:50:12 +02:00
|
|
|
while [ ! -d $ROOT/.git ]; do
|
2015-03-02 22:56:35 +01:00
|
|
|
ROOT=`dirname $ROOT`
|
2014-04-11 18:50:12 +02:00
|
|
|
done
|
|
|
|
|
2014-06-29 01:54:10 +02:00
|
|
|
[ -z $BUILD ] && BUILD=Debug
|
2014-04-12 05:25:21 +02:00
|
|
|
MACHINE=`uname -m`
|
2015-06-17 07:50:35 +02:00
|
|
|
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
|
2014-04-11 18:50:12 +02:00
|
|
|
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
|
|
|
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
|
|
|
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
2014-06-29 01:54:10 +02:00
|
|
|
BIN_DIR="build-$MACHINE-$CC-$BUILD"
|
2014-04-12 05:25:21 +02:00
|
|
|
|
2015-03-02 22:56:35 +01:00
|
|
|
[ -z "$JOBS" ] && [ "" != "which nproc" ] && JOBS=`nproc`
|
2014-04-12 04:40:48 +02:00
|
|
|
DISTCC=`which distcc`
|
|
|
|
if [ ! -z "$DISTCC" ] ; then
|
|
|
|
JOBS=`distcc -j`
|
|
|
|
if [ -z "$JOBS" ] ; then
|
|
|
|
JOBS=1
|
|
|
|
elif [ $JOBS -gt 1 ] ; then
|
|
|
|
CC="$DISTCC $CC"
|
|
|
|
MAKEOPTS=-j$JOBS
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "Building with $CC and $JOBS jobs"
|
|
|
|
|
2014-04-11 18:50:12 +02:00
|
|
|
if [ ! -d $ROOT/$BIN_DIR ]; then
|
|
|
|
echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2015-07-11 14:33:09 +02:00
|
|
|
git submodule update
|
2014-04-11 18:50:12 +02:00
|
|
|
cd $ROOT/$BIN_DIR
|
2014-04-12 04:40:48 +02:00
|
|
|
make $MAKEOPTS && make test
|
2014-07-03 06:35:16 +02:00
|
|
|
cd $OLDPWD
|