diff --git a/build.sh b/build.sh index c4c209f..43a4473 100755 --- a/build.sh +++ b/build.sh @@ -5,7 +5,14 @@ make clean 1>/dev/null 2>/dev/null echo -n "building..." -CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -f $3 all_test 1>gcc_1.txt 2>gcc_2.txt +if [ -f /proc/cpuinfo ] +then + MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 )) +else + MAKE_JOBS=8 +fi + +CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -j$MAKE_JOBS -f $3 all_test 1>gcc_1.txt 2>gcc_2.txt mret=$? cnt=$(wc -l < gcc_2.txt) # ignore 2 lines since ar prints to stderr instead of stdout and ar is called for