@@ -78,11 +78,19 @@ 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+ # For command compatibility. Use $(NODE_REL) when possible.
85+ # Use $(PWD) so we can cd to anywhere before calling this.
86+ NODE ?= "$(PWD ) /$(NODE_EXE ) "
87+ # Release build of node.
88+ NODE_REL ?= "$(NODE ) "
89+ # Prefer $(OUT_NODE) when using it to run tests. Prefer $(NODE_REL)
90+ # when using it to generate coverage reports or run toolings as
91+ # debug build is be slower.
92+ OUT_NODE ?= "$(PWD ) /out/$(BUILDTYPE ) /node$(EXEEXT ) "
93+
8694# Flags for packaging.
8795BUILD_DOWNLOAD_FLAGS ?= --download=all
8896BUILD_INTL_FLAGS ?= --with-intl=full-icu
@@ -94,8 +102,8 @@ V ?= 0
94102
95103# Use -e to double check in case it's a broken link
96104available-node = \
97- if [ -x "$(NODE ) " ] && [ -e "$(NODE ) " ]; then \
98- "$(NODE ) " $(1 ) ; \
105+ if [ -x "$(NODE_REL ) " ] && [ -e "$(NODE_REL ) " ]; then \
106+ "$(NODE_REL ) " $(1 ) ; \
99107 elif [ -x ` command -v node ` ] && [ -e ` command -v node ` ] && [ ` command -v node ` ]; then \
100108 ` command -v node ` $(1 ) ; \
101109 else \
@@ -108,8 +116,10 @@ available-node = \
108116# just the debug build, run `make -C out BUILDTYPE=Debug` instead.
109117ifeq ($(BUILDTYPE ) ,Release)
110118all : $(NODE_EXE ) # # Build node in out/Release/node (Default).
119+ $(OUT_NODE ) : $(NODE_EXE )
111120else
112121all : $(NODE_EXE ) $(NODE_G_EXE )
122+ $(OUT_NODE ) : $(NODE_G_EXE )
113123endif
114124
115125.PHONY : help
@@ -260,7 +270,7 @@ coverage-build: all ## Build coverage files.
260270coverage-build-js : # # Build JavaScript coverage files.
261271 mkdir -p node_modules
262272 if [ ! -d node_modules/c8 ]; then \
263- $(NODE ) ./deps/npm install c8 --no-save --no-package-lock; \
273+ $(NODE_REL ) ./deps/npm install c8 --no-save --no-package-lock; \
264274 fi
265275
266276.PHONY : coverage-test
@@ -287,13 +297,13 @@ coverage-test: coverage-build ## Run the tests and generate a coverage report.
287297.PHONY : coverage-report-js
288298coverage-report-js : # # Report JavaScript coverage results.
289299 -$(MAKE ) coverage-build-js
290- $(NODE ) ./node_modules/.bin/c8 report
300+ $(NODE_REL ) ./node_modules/.bin/c8 report
291301
292302.PHONY : cctest
293303
294304cctest : all # # Run the C++ tests using the built `cctest` executable.
295305 @out/$(BUILDTYPE ) /$@ --gtest_filter=$(GTEST_FILTER )
296- $(NODE ) ./test/embedding/test-embedding.js
306+ $(OUT_NODE ) ./test/embedding/test-embedding.js
297307
298308.PHONY : list-gtests
299309list-gtests : # # List all available C++ gtests.
@@ -385,7 +395,7 @@ test/addons/.docbuildstamp: $(DOCBUILDSTAMP_PREREQS) tools/doc/node_modules
385395 echo " Skipping .docbuildstamp (no crypto and/or no ICU)" ; \
386396 else \
387397 $(RM ) -r test/addons/?? _* /; \
388- [ -x $( NODE ) ] && $(NODE ) $< || node $< ; \
398+ [ -x $( NODE_REL ) ] && $(NODE_REL ) $< || node $< ; \
389399 [ $$ ? -eq 0 ] && touch $@ ; \
390400 fi
391401
@@ -605,7 +615,7 @@ test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tes
605615 $(PYTHON ) tools/test.py $(PARALLEL_ARGS ) -p tap --logfile test.tap \
606616 --mode=$(BUILDTYPE_LOWER ) --flaky-tests=$(FLAKY_TESTS ) \
607617 $(TEST_CI_ARGS ) $(CI_JS_SUITES ) $(CI_NATIVE_SUITES ) $(CI_DOC )
608- $(NODE ) ./test/embedding/test-embedding.js
618+ $(OUT_NODE ) ./test/embedding/test-embedding.js
609619 $(info Clean up any leftover processes, error if found.)
610620 ps awwx | grep Release/node | grep -v grep | cat
611621 @PS_OUT=` ps awwx | grep Release/node | grep -v grep | awk ' {print $$1}' ` ; \
@@ -651,8 +661,8 @@ test-wpt: all ## Run the Web Platform Tests.
651661test-wpt-report : # # Run the Web Platform Tests and generate a report.
652662 $(RM ) -r out/wpt
653663 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"
664+ -WPT_REPORT=1 $(PYTHON ) tools/test.py --shell $(OUT_NODE ) $(PARALLEL_ARGS ) wpt
665+ $(NODE_REL ) " $$ PWD/tools/merge-wpt-reports.mjs"
656666
657667.PHONY : test-internet
658668test-internet : all # # Run internet tests.
@@ -672,20 +682,20 @@ test-doc: doc-only lint-md ## Build, lint, and verify the docs.
672682
673683.PHONY : test-doc-ci
674684test-doc-ci : doc-only # # Build, lint, and verify the docs (CI).
675- $(PYTHON ) tools/test.py --shell $(NODE ) $(TEST_CI_ARGS ) $(PARALLEL_ARGS ) doctool
685+ $(PYTHON ) tools/test.py --shell $(OUT_NODE ) $(TEST_CI_ARGS ) $(PARALLEL_ARGS ) doctool
676686
677687.PHONY : test-known-issues
678688test-known-issues : all # # Run tests for known issues.
679689 $(PYTHON ) tools/test.py $(PARALLEL_ARGS ) known_issues
680690
681691# Related CI job: node-test-npm
682692.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
693+ test-npm : $(OUT_NODE ) # # Run the npm test suite on deps/npm.
694+ $(OUT_NODE ) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test
685695
686696.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
697+ test-npm-publish : $(OUT_NODE ) # # Test the `npm publish` command.
698+ npm_package_config_publishtest=true $(OUT_NODE ) deps/npm/test/run.js
689699
690700.PHONY : test-js-native-api
691701test-js-native-api : test-build-js-native-api # # Run JS Native-API tests.
@@ -1169,7 +1179,7 @@ endif
11691179 $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
11701180 unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/npm
11711181 unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/npx
1172- $(NODE ) tools/license2rtf.mjs < LICENSE > \
1182+ $(NODE_REL ) tools/license2rtf.mjs < LICENSE > \
11731183 $(MACOSOUTDIR)/installer/productbuild/Resources/license.rtf
11741184 cp doc/osx_installer_logo.png $(MACOSOUTDIR)/installer/productbuild/Resources
11751185 pkgbuild --version $(FULLVERSION) \
0 commit comments