diff --git a/build.sh b/build.sh index 2807db98..ebf4ce37 100755 --- a/build.sh +++ b/build.sh @@ -18,5 +18,8 @@ if [ ! -f config.mk ]; then cp make/config.mk config.mk fi -make -j4 +# Use as many CPUs as the host has to build, or default to +# 4 if we're not on a unix-y system. +num_cpus=$(grep -sc ^processor /proc/cpuinfo || echo 4) +make -j$num_cpus diff --git a/build_ps.sh b/build_ps.sh index b9e44b77..d0028b1e 100755 --- a/build_ps.sh +++ b/build_ps.sh @@ -28,5 +28,7 @@ fi sed -i 's/USE_DIST_PS.*/USE_DIST_PS = 1/' config.mk sed -i 's/PS_PATH.*/PS_PATH = .\/ps-lite/' config.mk -make -j4 -# make $1 +# Use as many CPUs as the host has to build, or default to +# 4 if we're not on a unix-y system. +num_cpus=$(grep -sc ^processor /proc/cpuinfo || echo 4) +make -j$num_cpus