diff --git a/dkarm-eabi/scripts/build-gcc.sh b/dkarm-eabi/scripts/build-gcc.sh index 41e1ff4..aff06a3 100755 --- a/dkarm-eabi/scripts/build-gcc.sh +++ b/dkarm-eabi/scripts/build-gcc.sh @@ -1,6 +1,10 @@ #!/bin/sh #--------------------------------------------------------------------------------- +numcores=`getconf _NPROCESSORS_ONLN` + +numjobs=$(($numcores * 2 + 1)) + #--------------------------------------------------------------------------------- # build and install binutils #--------------------------------------------------------------------------------- @@ -20,7 +24,7 @@ fi if [ ! -f built-binutils ] then - $MAKE || { echo "Error building binutils"; exit 1; } + $MAKE -j$numjobs || { echo "Error building binutils"; exit 1; } touch built-binutils fi @@ -64,7 +68,7 @@ fi if [ ! -f built-gcc ] then - $MAKE all-gcc || { echo "Error building gcc stage1"; exit 1; } + $MAKE all-gcc -j$numjobs || { echo "Error building gcc stage1"; exit 1; } touch built-gcc fi @@ -97,7 +101,7 @@ fi if [ ! -f built-newlib ] then - $MAKE || { echo "Error building newlib"; exit 1; } + $MAKE -j$numjobs || { echo "Error building newlib"; exit 1; } touch built-newlib fi @@ -118,7 +122,7 @@ cd $target/gcc if [ ! -f built-stage2 ] then - $MAKE all || { echo "Error building gcc stage2"; exit 1; } + $MAKE all -j$numjobs || { echo "Error building gcc stage2"; exit 1; } touch built-stage2 fi @@ -152,7 +156,7 @@ fi if [ ! -f built-gdb ] then - $MAKE || { echo "Error building gdb"; exit 1; } + $MAKE -j$numjobs || { echo "Error building gdb"; exit 1; } touch built-gdb fi