From 250e4e699fc4f40fdcfae4c2d1750f76d8d99cbc Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Fri, 1 May 2020 23:36:56 +0900 Subject: [PATCH] build: Inherit -n and -jN flags if Ninja #12219 --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 07dad26d7b..39f42739ff 100644 --- a/Makefile +++ b/Makefile @@ -58,11 +58,15 @@ endif BUILD_CMD = $(BUILD_TOOL) -ifneq ($(VERBOSE),) - # Only need to handle Ninja here. Make will inherit the VERBOSE variable. - ifeq ($(BUILD_TYPE),Ninja) +# Only need to handle Ninja here. Make will inherit the VERBOSE variable, and the -j and -n flags. +ifeq ($(BUILD_TYPE),Ninja) + ifneq ($(VERBOSE),) BUILD_CMD += -v endif + BUILD_CMD += $(shell printf '%s' '$(MAKEFLAGS)' | grep -o -- '-j[0-9]\+') + ifeq (n,$(findstring n,$(firstword -$(MAKEFLAGS)))) + BUILD_CMD += -n + endif endif DEPS_CMAKE_FLAGS ?=