@@ -16,6 +16,7 @@ GTEST_FILTER ?= "*"
1616GNUMAKEFLAGS += --no-print-directory
1717GCOV ?= gcov
1818PWD = $(CURDIR )
19+ BUILD_WITH ?= make
1920
2021ifdef JOBS
2122 PARALLEL_ARGS = -j $(JOBS )
@@ -95,13 +96,37 @@ help: ## Print help for targets with comments.
9596# Without the check there is a race condition between the link being deleted
9697# and recreated which can break the addons build when running test-ci
9798# See comments on the build-addons target for some more info
99+ ifeq ($(BUILD_WITH ) , make)
98100$(NODE_EXE ) : config.gypi out/Makefile
99101 $(MAKE ) -C out BUILDTYPE=Release V=$(V )
100102 if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Release/$( NODE_EXE) $@ ; fi
101103
102104$(NODE_G_EXE ) : config.gypi out/Makefile
103105 $(MAKE ) -C out BUILDTYPE=Debug V=$(V )
104106 if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Debug/$( NODE_EXE) $@ ; fi
107+ else
108+ ifeq ($(BUILD_WITH ) , ninja)
109+ ifeq ($(V ) ,1)
110+ NINJA_ARGS := $(NINJA_ARGS ) -v
111+ endif
112+ ifdef JOBS
113+ NINJA_ARGS := $(NINJA_ARGS ) -j$(JOBS )
114+ else
115+ NINJA_ARGS := $(NINJA_ARGS ) $(filter -j% ,$(MAKEFLAGS ) )
116+ endif
117+ $(NODE_EXE ) : config.gypi out/Release/build.ninja
118+ ninja -C out/Release $(NINJA_ARGS )
119+ if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Release/$( NODE_EXE) $@ ; fi
120+
121+ $(NODE_G_EXE ) : config.gypi out/Debug/build.ninja
122+ ninja -C out/Debug $(NINJA_ARGS )
123+ if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Debug/$( NODE_EXE) $@ ; fi
124+ else
125+ $(NODE_EXE ) $(NODE_G_EXE ) :
126+ echo This Makefile currently only supports building with ' make' or ' ninja'
127+ endif
128+ endif
129+
105130
106131ifeq ($(BUILDTYPE ) ,Debug)
107132CONFIG_FLAGS += --debug
0 commit comments