make build script figure out how many jobs to run

This commit is contained in:
Enno Rehling 2014-04-11 19:40:48 -07:00
parent 7358c48580
commit 9aeb0f6b86
2 changed files with 22 additions and 4 deletions

15
s/build
View File

@ -7,6 +7,19 @@ done
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" [ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" [ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc" [ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
[ -z "$JOBS" ] && 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"
MACHINE=`uname -m` MACHINE=`uname -m`
BIN_DIR="build-$MACHINE-$CC-Debug" BIN_DIR="build-$MACHINE-$CC-Debug"
if [ ! -d $ROOT/$BIN_DIR ]; then if [ ! -d $ROOT/$BIN_DIR ]; then
@ -15,5 +28,5 @@ if [ ! -d $ROOT/$BIN_DIR ]; then
fi fi
cd $ROOT/$BIN_DIR cd $ROOT/$BIN_DIR
make && make test make $MAKEOPTS && make test
cd - cd -

View File

@ -252,7 +252,9 @@ bool b_blockall(const connection * b, const unit * u, const region * r)
bool b_blocknone(const connection * b, const unit * u, const region * r) bool b_blocknone(const connection * b, const unit * u, const region * r)
{ {
unused_arg((u, r, b)); unused_arg(u);
unused_arg(r);
unused_arg(b);
return false; return false;
} }
@ -264,13 +266,16 @@ bool b_rvisible(const connection * b, const region * r)
bool b_fvisible(const connection * b, const struct faction * f, bool b_fvisible(const connection * b, const struct faction * f,
const region * r) const region * r)
{ {
unused_arg(r, f, b); unused_arg(r);
unused_arg(f);
unused_arg(b);
return true; return true;
} }
bool b_uvisible(const connection * b, const unit * u) bool b_uvisible(const connection * b, const unit * u)
{ {
unused_arg(u, b); unused_arg(u);
unused_arg(b);
return true; return true;
} }