Use nproc build jobs
authorDave Stevenson <dave.stevenson@raspberrypi.org>
Thu, 23 Mar 2017 09:58:39 +0000 (09:58 +0000)
committerpopcornmix <popcornmix@gmail.com>
Wed, 5 Apr 2017 13:30:10 +0000 (14:30 +0100)
Fixes #377.
Replace hard coded -j6 in make lines for -j `nproc`
to adopt the same number of jobs as processor cores.

Discussion abounds as to whether there is a better
multiple for CPU vs I/O speeds, but it's better than
always using 6.

buildme

diff --git a/buildme b/buildme
index 1061745b74b1920441badc647f6c442d1e5dec54..b8fd4408efb69ad2a70d49e4fc5541f4533711fe 100755 (executable)
--- a/buildme
+++ b/buildme
@@ -29,13 +29,13 @@ elif [ "$1" = "--native" ]; then
        pushd build/native/$BUILDSUBDIR
        cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE ../../..
        shift
-       make -j 6 $*
+       make -j `nproc` $*
 else
        # Cross compile on a more capable machine
        mkdir -p build/arm-linux/$BUILDSUBDIR
        pushd build/arm-linux/$BUILDSUBDIR
        cmake -DCMAKE_TOOLCHAIN_FILE=../../../makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE ../../..
-       make -j 6
+       make -j `nproc`
 
        if [ "$1" != "" ]; then
                sudo make install DESTDIR=$1