server/s/build

36 lines
811 B
Plaintext
Raw Normal View History

2014-04-11 18:50:12 +02:00
#!/bin/sh
ROOT=`pwd`
2014-04-11 18:50:12 +02:00
while [ ! -d $ROOT/.git ]; do
ROOT=`dirname $ROOT`
2014-04-11 18:50:12 +02:00
done
2014-06-29 01:54:10 +02:00
[ -z $BUILD ] && BUILD=Debug
MACHINE=`uname -m`
[ -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"
[ -z "$JOBS" ] && [ "" != "which nproc" ] && JOBS=`nproc`
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
cd $ROOT/$BIN_DIR
make $MAKEOPTS && make test
cd $OLDPWD