]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
better way to find number of CPUs
authorRudolf Polzer <divverent@alientrap.org>
Sat, 3 Mar 2012 16:07:56 +0000 (17:07 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 3 Mar 2012 16:07:56 +0000 (17:07 +0100)
misc/tools/all/xonotic.subr

index c8b7f8f17dae6128324dd357d21ac1892c713347..dca4a33de4ae70b9eb081692961c5a9693e24854 100644 (file)
@@ -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="