@@ -78,11 +78,16 @@ EXEEXT := $(shell $(PYTHON) -c \
7878 "import sys; print('.exe' if sys.platform == 'win32' else '') ")
7979
8080NODE_EXE = node$(EXEEXT )
81- # Use $(PWD) so we can cd to anywhere before calling this
82- NODE ?= "$(PWD ) /$(NODE_EXE ) "
8381NODE_G_EXE = node_g$(EXEEXT )
8482NPM ?= ./deps/npm/bin/npm-cli.js
8583
84+ # Release build of node. Use $(PWD) so we can cd to anywhere before calling this
85+ NODE_REL ?= "$(PWD ) /$(NODE_EXE ) "
86+ # Prefer $(OUT_NODE) when using it to run tests. Prefer $(NODE_REL)
87+ # when using it to generate coverage reports or run toolings as
88+ # debug build is be slower.
89+ OUT_NODE = "$(PWD ) /out/$(BUILDTYPE ) /node$(EXEEXT ) "
90+
8691# Flags for packaging.
8792BUILD_DOWNLOAD_FLAGS ?= --download=all
8893BUILD_INTL_FLAGS ?= --with-intl=full-icu
9499
95100# Use -e to double check in case it's a broken link
96101available-node = \
97- if [ -x "$(NODE ) " ] && [ -e "$(NODE ) " ]; then \
98- "$(NODE ) " $(1 ) ; \
102+ if [ -x "$(NODE_REL ) " ] && [ -e "$(NODE_REL ) " ]; then \
103+ "$(NODE_REL ) " $(1 ) ; \
99104 elif [ -x ` command -v node ` ] && [ -e ` command -v node ` ] && [ ` command -v node ` ]; then \
100105 ` command -v node ` $(1 ) ; \
101106 else \
@@ -108,8 +113,10 @@ available-node = \
108113# just the debug build, run `make -C out BUILDTYPE=Debug` instead.
109114ifeq ($(BUILDTYPE ) ,Release)
110115all : $(NODE_EXE ) # # Build node in out/Release/node (Default).
116+ $(OUT_NODE ) : $(NODE_EXE )
111117else
112118all : $(NODE_EXE ) $(NODE_G_EXE )
119+ $(OUT_NODE ) : $(NODE_G_EXE )
113120endif
114121
115122.PHONY : help
@@ -260,7 +267,7 @@ coverage-build: all ## Build coverage files.
260267coverage-build-js : # # Build JavaScript coverage files.
261268 mkdir -p node_modules
262269 if [ ! -d node_modules/c8 ]; then \
263- $(NODE ) ./deps/npm install c8 --no-save --no-package-lock; \
270+ $(NODE_REL ) ./deps/npm install c8 --no-save --no-package-lock; \
264271 fi
265272
266273.PHONY : coverage-test
@@ -287,13 +294,13 @@ coverage-test: coverage-build ## Run the tests and generate a coverage report.
287294.PHONY : coverage-report-js
288295coverage-report-js : # # Report JavaScript coverage results.
289296 -$(MAKE ) coverage-build-js
290- $(NODE ) ./node_modules/.bin/c8 report
297+ $(NODE_REL ) ./node_modules/.bin/c8 report
291298
292299.PHONY : cctest
293300
294301cctest : all # # Run the C++ tests using the built `cctest` executable.
295302 @out/$(BUILDTYPE ) /$@ --gtest_filter=$(GTEST_FILTER )
296- $(NODE ) ./test/embedding/test-embedding.js
303+ $(OUT_NODE ) ./test/embedding/test-embedding.js
297304
298305.PHONY : list-gtests
299306list-gtests : # # List all available C++ gtests.
@@ -385,7 +392,7 @@ test/addons/.docbuildstamp: $(DOCBUILDSTAMP_PREREQS) tools/doc/node_modules
385392 echo " Skipping .docbuildstamp (no crypto and/or no ICU)" ; \
386393 else \
387394 $(RM ) -r test/addons/?? _* /; \
388- [ -x $( NODE ) ] && $(NODE ) $< || node $< ; \
395+ [ -x $( NODE_REL ) ] && $(NODE_REL ) $< || node $< ; \
389396 [ $$ ? -eq 0 ] && touch $@ ; \
390397 fi
391398
@@ -605,7 +612,7 @@ test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tes
605612 $(PYTHON ) tools/test.py $(PARALLEL_ARGS ) -p tap --logfile test.tap \
606613 --mode=$(BUILDTYPE_LOWER ) --flaky-tests=$(FLAKY_TESTS ) \
607614 $(TEST_CI_ARGS ) $(CI_JS_SUITES ) $(CI_NATIVE_SUITES ) $(CI_DOC )
608- $(NODE ) ./test/embedding/test-embedding.js
615+ $(OUT_NODE ) ./test/embedding/test-embedding.js
609616 $(info Clean up any leftover processes, error if found.)
610617 ps awwx | grep Release/node | grep -v grep | cat
611618 @PS_OUT=` ps awwx | grep Release/node | grep -v grep | awk ' {print $$1}' ` ; \
@@ -651,8 +658,8 @@ test-wpt: all ## Run the Web Platform Tests.
651658test-wpt-report : # # Run the Web Platform Tests and generate a report.
652659 $(RM ) -r out/wpt
653660 mkdir -p out/wpt
654- -WPT_REPORT=1 $(PYTHON ) tools/test.py --shell $(NODE ) $(PARALLEL_ARGS ) wpt
655- $(NODE ) " $$ PWD/tools/merge-wpt-reports.mjs"
661+ -WPT_REPORT=1 $(PYTHON ) tools/test.py --shell $(OUT_NODE ) $(PARALLEL_ARGS ) wpt
662+ $(NODE_REL ) " $$ PWD/tools/merge-wpt-reports.mjs"
656663
657664.PHONY : test-internet
658665test-internet : all # # Run internet tests.
@@ -672,20 +679,20 @@ test-doc: doc-only lint-md ## Build, lint, and verify the docs.
672679
673680.PHONY : test-doc-ci
674681test-doc-ci : doc-only # # Build, lint, and verify the docs (CI).
675- $(PYTHON ) tools/test.py --shell $(NODE ) $(TEST_CI_ARGS ) $(PARALLEL_ARGS ) doctool
682+ $(PYTHON ) tools/test.py --shell $(OUT_NODE ) $(TEST_CI_ARGS ) $(PARALLEL_ARGS ) doctool
676683
677684.PHONY : test-known-issues
678685test-known-issues : all # # Run tests for known issues.
679686 $(PYTHON ) tools/test.py $(PARALLEL_ARGS ) known_issues
680687
681688# Related CI job: node-test-npm
682689.PHONY : test-npm
683- test-npm : $(NODE_EXE ) # # Run the npm test suite on deps/npm.
684- $(NODE ) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test
690+ test-npm : $(OUT_NODE ) # # Run the npm test suite on deps/npm.
691+ $(OUT_NODE ) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test
685692
686693.PHONY : test-npm-publish
687- test-npm-publish : $(NODE_EXE ) # # Test the `npm publish` command.
688- npm_package_config_publishtest=true $(NODE ) deps/npm/test/run.js
694+ test-npm-publish : $(OUT_NODE ) # # Test the `npm publish` command.
695+ npm_package_config_publishtest=true $(OUT_NODE ) deps/npm/test/run.js
689696
690697.PHONY : test-js-native-api
691698test-js-native-api : test-build-js-native-api # # Run JS Native-API tests.
@@ -1169,7 +1176,7 @@ endif
11691176 $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
11701177 unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/npm
11711178 unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/npx
1172- $(NODE ) tools/license2rtf.mjs < LICENSE > \
1179+ $(NODE_REL ) tools/license2rtf.mjs < LICENSE > \
11731180 $(MACOSOUTDIR)/installer/productbuild/Resources/license.rtf
11741181 cp doc/osx_installer_logo.png $(MACOSOUTDIR)/installer/productbuild/Resources
11751182 pkgbuild --version $(FULLVERSION) \
0 commit comments