make.sh: Add function to determine how many CPU cores the build host has

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2017-11-07 15:25:11 +01:00
parent 7e1639a481
commit 1445a5ac43
2 changed files with 5 additions and 4 deletions

View File

@@ -189,10 +189,7 @@ prepareenv() {
set +h
LC_ALL=POSIX
if [ -z $MAKETUNING ]; then
CPU_COUNT="$(getconf _NPROCESSORS_ONLN 2>/dev/null)"
if [ -z "${CPU_COUNT}" ]; then
CPU_COUNT=1
fi
CPU_COUNT="$(system_processors)"
MAKETUNING="-j$(( ${CPU_COUNT} * 2 + 1 ))"
fi