forked from Archive/PX4-Autopilot
build: use ninja default for -jN unless set
It makes sense to trust ninja on selecting the number of cores. This is also sensible in order not to change existing setups.
This commit is contained in:
parent
0ec9287457
commit
6afdc2c376
14
Makefile
14
Makefile
|
@ -74,8 +74,6 @@ ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
||||||
# https://stackoverflow.com/a/33616144/8548472
|
# https://stackoverflow.com/a/33616144/8548472
|
||||||
MAKE_PID := $(shell echo $$PPID)
|
MAKE_PID := $(shell echo $$PPID)
|
||||||
j := $(shell ps T | sed -n 's/.*$(MAKE_PID).*$(MAKE).* \(-j\|--jobs\) *\([0-9][0-9]*\).*/\2/p')
|
j := $(shell ps T | sed -n 's/.*$(MAKE_PID).*$(MAKE).* \(-j\|--jobs\) *\([0-9][0-9]*\).*/\2/p')
|
||||||
# Default to 4
|
|
||||||
j := $(or $(j),4)
|
|
||||||
|
|
||||||
NINJA_BIN := ninja
|
NINJA_BIN := ninja
|
||||||
ifndef NO_NINJA_BUILD
|
ifndef NO_NINJA_BUILD
|
||||||
|
@ -92,9 +90,14 @@ ifdef NINJA_BUILD
|
||||||
PX4_MAKE := $(NINJA_BIN)
|
PX4_MAKE := $(NINJA_BIN)
|
||||||
|
|
||||||
ifdef VERBOSE
|
ifdef VERBOSE
|
||||||
PX4_MAKE_ARGS := -j $(j) -v
|
PX4_MAKE_ARGS := -v
|
||||||
else
|
else
|
||||||
PX4_MAKE_ARGS := -j $(j)
|
PX4_MAKE_ARGS :=
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Only override ninja default if -j is set.
|
||||||
|
ifneq ($(j),)
|
||||||
|
PX4_MAKE_ARGS := $(PX4_MAKE_ARGS) -j$(j)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
ifdef SYSTEMROOT
|
ifdef SYSTEMROOT
|
||||||
|
@ -103,6 +106,9 @@ else
|
||||||
else
|
else
|
||||||
PX4_CMAKE_GENERATOR := "Unix\ Makefiles"
|
PX4_CMAKE_GENERATOR := "Unix\ Makefiles"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# For non-ninja builds we default to -j4
|
||||||
|
j := $(or $(j),4)
|
||||||
PX4_MAKE = $(MAKE)
|
PX4_MAKE = $(MAKE)
|
||||||
PX4_MAKE_ARGS = -j$(j) --no-print-directory
|
PX4_MAKE_ARGS = -j$(j) --no-print-directory
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue