[build] only build firmware in parallel with J=AUTO

by passing J=AUTO from toplevel make it will auto-detect the number of CPUs
Number of processes can also be explicitly set with e.g. J=4
Calling make without a J variable is the same as J=1 (serial compilation)
This commit is contained in:
Felix Ruess
2014-04-11 19:58:56 +02:00
parent e0f80abb32
commit bd00beb101
+7 -3
View File
@@ -57,17 +57,21 @@ else
endif
# detection of number of processors for parallel compilation
# can be overridden by calling toplevel make with e.g. J=2
# by passing J=AUTO from toplevel make.
# Number of processes can also be explicitly set with e.g. J=4
# Calling make without a J variable is the same as J=1 (serial compilation)
NPROCS := 1
ifeq ($J,)
ifdef J
ifeq ($J,AUTO)
ifeq ($(UNAME),Linux)
NPROCS := $(shell grep -c ^processor /proc/cpuinfo)
else ifeq ($(UNAME),Darwin)
NPROCS := $(shell sysctl hw.ncpu | awk '{print $$2}')
endif # $(UNAME)
else
else # not auto, explicitly specified
NPROCS := $J
endif # $J
endif
# "make Q=''" to get full echo