From d6c12f67ce8e308050c56bf7510226166b073ae6 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 3 Mar 2012 17:07:56 +0100 Subject: [PATCH] better way to find number of CPUs --- misc/tools/all/xonotic.subr | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/misc/tools/all/xonotic.subr b/misc/tools/all/xonotic.subr index c8b7f8f1..dca4a33d 100644 --- a/misc/tools/all/xonotic.subr +++ b/misc/tools/all/xonotic.subr @@ -113,11 +113,9 @@ case "$cmd" in fi fi if [ -z "$MAKEFLAGS" ]; then - if [ -f /proc/cpuinfo ]; then - ncpus=$((`grep -c '^processor :' /proc/cpuinfo || true`+0)) - if [ $ncpus -gt 1 ]; then - MAKEFLAGS=-j$ncpus - fi + ncpus=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1` + if [ $ncpus -gt 1 ]; then + MAKEFLAGS=-j$ncpus fi if [ -n "$WE_HATE_OUR_USERS" ]; then MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw LIB_JPEG= CFLAGS_LIBJPEG=" -- 2.39.2