From 424e5be0467aad70bf249ca24b566f8a2d4e8c56 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Jun 2015 08:26:33 +1000 Subject: Makefile support for using NPROCS as an env var --- GNUmakefile | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 80366af2610..d37d810626f 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -81,18 +81,20 @@ endif # ----------------------------------------------------------------------------- # Get the number of cores for threaded build -NPROCS:=1 -ifeq ($(OS), Linux) - NPROCS:=$(shell nproc) -endif -ifeq ($(OS), Darwin) - NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f3) -endif -ifeq ($(OS), FreeBSD) - NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 ) -endif -ifeq ($(OS), NetBSD) - NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 ) +ifndef NPROCS + NPROCS:=1 + ifeq ($(OS), Linux) + NPROCS:=$(shell nproc) + endif + ifeq ($(OS), Darwin) + NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f3) + endif + ifeq ($(OS), FreeBSD) + NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 ) + endif + ifeq ($(OS), NetBSD) + NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 ) + endif endif -- cgit v1.2.3