[build] parallel build for firmwares

on OSX using sysctl seems to be faster than using system_profile and also more robust
(output is not named differently)
This commit is contained in:
Felix Ruess
2014-04-03 21:57:33 +02:00
parent d41af456ee
commit e0f80abb32
4 changed files with 32 additions and 7 deletions
+16 -2
View File
@@ -56,6 +56,20 @@ else
MKTEMP = mktemp
endif
# detection of number of processors for parallel compilation
# can be overridden by calling toplevel make with e.g. J=2
NPROCS := 1
ifeq ($J,)
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
NPROCS := $J
endif # $J
# "make Q=''" to get full echo
Q=@
@@ -176,8 +190,8 @@ $(SETTINGS_TELEMETRY) : $(PERIODIC_H)
@echo BUILD $(AIRCRAFT), TARGET $*
$(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) TARGET=$* Q=$(Q) $(GENERATORS)/gen_aircraft.out $(AIRCRAFT)
%.compile: %.ac_h print_version
cd $(AIRBORNE); $(MAKE) TARGET=$* all
%.compile: %.ac_h | print_version
cd $(AIRBORNE); $(MAKE) -j$(NPROCS) TARGET=$* all
%.upload: %.compile
cd $(AIRBORNE); $(MAKE) TARGET=$* upload