Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2019-05-01 00:59:00 +0300
committerRefael Ackermann <refack@gmail.com>2019-05-03 04:03:53 +0300
commit46eb532a2a144ebd0fe1aa91a2b4a9e9372aa902 (patch)
tree88103e740110d7e7d69812a7535e49739b2db0d4 /Makefile
parent50364d98d97afd9e7dc3947c270c45ef64944a6f (diff)
build: delegate building from Makefile to ninja
PR-URL: https://github.com/nodejs/node/pull/27504 Refs: https://mobile.twitter.com/refack/status/1118484079077482498 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 25 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index d41bf1601fb..5834df883b0 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,7 @@ GTEST_FILTER ?= "*"
GNUMAKEFLAGS += --no-print-directory
GCOV ?= gcov
PWD = $(CURDIR)
+BUILD_WITH ?= make
ifdef JOBS
PARALLEL_ARGS = -j $(JOBS)
@@ -95,6 +96,7 @@ help: ## Print help for targets with comments.
# Without the check there is a race condition between the link being deleted
# and recreated which can break the addons build when running test-ci
# See comments on the build-addons target for some more info
+ifeq ($(BUILD_WITH), make)
$(NODE_EXE): config.gypi out/Makefile
$(MAKE) -C out BUILDTYPE=Release V=$(V)
if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Release/$(NODE_EXE) $@; fi
@@ -102,6 +104,29 @@ $(NODE_EXE): config.gypi out/Makefile
$(NODE_G_EXE): config.gypi out/Makefile
$(MAKE) -C out BUILDTYPE=Debug V=$(V)
if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Debug/$(NODE_EXE) $@; fi
+else
+ifeq ($(BUILD_WITH), ninja)
+ifeq ($(V),1)
+ NINJA_ARGS := $(NINJA_ARGS) -v
+endif
+ifdef JOBS
+ NINJA_ARGS := $(NINJA_ARGS) -j$(JOBS)
+else
+ NINJA_ARGS := $(NINJA_ARGS) $(filter -j%,$(MAKEFLAGS))
+endif
+$(NODE_EXE): config.gypi out/Release/build.ninja
+ ninja -C out/Release $(NINJA_ARGS)
+ if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Release/$(NODE_EXE) $@; fi
+
+$(NODE_G_EXE): config.gypi out/Debug/build.ninja
+ ninja -C out/Debug $(NINJA_ARGS)
+ if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Debug/$(NODE_EXE) $@; fi
+else
+$(NODE_EXE) $(NODE_G_EXE):
+ echo This Makefile currently only supports building with 'make' or 'ninja'
+endif
+endif
+
ifeq ($(BUILDTYPE),Debug)
CONFIG_FLAGS += --debug