Browse Source

automatically determine the number of parallel make jobs for the tests

Steffen Jaeckel 9 years ago
parent
commit
892342c769
1 changed files with 8 additions and 1 deletions
  1. 8 1
      build.sh

+ 8 - 1
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