Skip to content

Commit d93b476

Browse files
joyeecheungMylesBorins
authored andcommitted
build: document targets in the Makefile
PR-URL: #16975 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent bb9219b commit d93b476

File tree

1 file changed

+53
-18
lines changed

1 file changed

+53
-18
lines changed

Makefile

+53-18
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ coverage-clean:
159159
# instrumented for any additional runs the user may want to make.
160160
# For C++ coverage reporting, this needs to be run in conjunction with configure
161161
# --coverage. html coverage reports will be created under coverage/
162+
# Related CI job: node-test-commit-linux-coverage
162163
coverage: coverage-test ## Run the tests and generate a coverage report.
163164

164165
.PHONY: coverage-build
@@ -209,6 +210,7 @@ coverage-test: coverage-build
209210
| sed 's/<[^>]*>//g'| sed 's/ //g'
210211

211212
.PHONY: cctest
213+
# Runs the C++ tests using the built `cctest` executable.
212214
cctest: all
213215
@out/$(BUILDTYPE)/$@ --gtest_filter=$(GTEST_FILTER)
214216

@@ -220,12 +222,16 @@ endif
220222
@out/$(BUILDTYPE)/cctest --gtest_list_tests
221223

222224
.PHONY: v8
225+
# Related CI job: node-test-commit-v8-linux
226+
# Rebuilds deps/v8 as a git tree, pulls its third-party dependencies, and
227+
# builds it.
223228
v8:
224229
tools/make-v8.sh
225230
$(MAKE) -C deps/v8 $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
226231

227232
.PHONY: test
228-
test: all ## Default test target. Runs default tests, linters, and builds docs.
233+
# This does not run tests of third-party libraries inside deps.
234+
test: all ## Runs default tests, linters, and builds docs.
229235
$(MAKE) -s build-addons
230236
$(MAKE) -s build-addons-napi
231237
$(MAKE) -s doc-only
@@ -237,15 +243,15 @@ test: all ## Default test target. Runs default tests, linters, and builds docs.
237243
$(CI_DOC)
238244

239245
.PHONY: test-only
240-
# For a quick test, does not run linter or build doc
241-
test-only: all
246+
test-only: all ## For a quick test, does not run linter or build docs.
242247
$(MAKE) build-addons
243248
$(MAKE) build-addons-napi
244249
$(MAKE) cctest
245250
$(PYTHON) tools/test.py --mode=release -J \
246251
$(CI_JS_SUITES) \
247252
$(CI_NATIVE_SUITES)
248253

254+
# Used by `make coverage-test`
249255
test-cov: all
250256
$(MAKE) build-addons
251257
$(MAKE) build-addons-napi
@@ -408,6 +414,7 @@ CI_DOC := doctool
408414

409415
.PHONY: test-ci-native
410416
# Build and test addons without building anything else
417+
# Related CI job: node-test-commit-arm-fanned
411418
test-ci-native: LOGLEVEL := info
412419
test-ci-native: | test/addons/.buildstamp test/addons-napi/.buildstamp
413420
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
@@ -416,6 +423,7 @@ test-ci-native: | test/addons/.buildstamp test/addons-napi/.buildstamp
416423

417424
.PHONY: test-ci-js
418425
# This target should not use a native compiler at all
426+
# Related CI job: node-test-commit-arm-fanned
419427
test-ci-js: | clear-stalled
420428
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
421429
--mode=release --flaky-tests=$(FLAKY_TESTS) \
@@ -428,6 +436,7 @@ test-ci-js: | clear-stalled
428436
fi
429437

430438
.PHONY: test-ci
439+
# Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
431440
test-ci: LOGLEVEL := info
432441
test-ci: | clear-stalled build-addons build-addons-napi doc-only
433442
out/Release/cctest --gtest_output=tap:cctest.tap
@@ -441,6 +450,23 @@ test-ci: | clear-stalled build-addons build-addons-napi doc-only
441450
echo $${PS_OUT} | xargs kill; exit 1; \
442451
fi
443452

453+
.PHONY: build-ci
454+
# Prepare the build for running the tests.
455+
# Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
456+
build-ci:
457+
$(PYTHON) ./configure $(CONFIG_FLAGS)
458+
$(MAKE)
459+
460+
.PHONY: run-ci
461+
# Run by CI tests, exceptions:
462+
# - node-test-commit-arm-fanned (Raspberry Pis), where the binaries are
463+
# cross-compiled, then transferred elsewhere to run different subsets
464+
# of tests. See `test-ci-native` and `test-ci-js`.
465+
# - node-test-commit-linux-coverage: where the build and the tests need
466+
# to be instrumented, see `coverage`.
467+
run-ci: build-ci
468+
$(MAKE) test-ci
469+
444470
test-release: test-build
445471
$(PYTHON) tools/test.py --mode=release
446472

@@ -467,17 +493,19 @@ test-tick-processor: all
467493
$(PYTHON) tools/test.py tick-processor
468494

469495
.PHONY: test-hash-seed
496+
# Verifies the hash seed used by V8 for hashing is random.
470497
test-hash-seed: all
471498
$(NODE) test/pummel/test-hash-seed.js
472499

473500
.PHONY: test-doc
474-
test-doc: doc-only
501+
test-doc: doc-only ## Builds, lints, and verifies the docs.
475502
$(MAKE) lint
476503
$(PYTHON) tools/test.py $(CI_DOC)
477504

478505
test-known-issues: all
479506
$(PYTHON) tools/test.py known_issues
480507

508+
# Related CI job: node-test-npm
481509
test-npm: $(NODE_EXE) ## Run the npm test suite on deps/npm.
482510
$(NODE) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test-node
483511

@@ -528,8 +556,12 @@ test-with-async-hooks:
528556
.PHONY: test-v8-benchmarks
529557
.PHONY: test-v8-intl
530558
ifneq ("","$(wildcard deps/v8/tools/run-tests.py)")
559+
# Related CI job: node-test-commit-v8-linux
531560
test-v8: v8 ## Runs the V8 test suite on deps/v8.
532-
# note: performs full test unless QUICKCHECK is specified
561+
# Performs a full test unless QUICKCHECK is specified.
562+
# Note that we cannot run the tests in deps/v8 directly without rebuilding a
563+
# git tree and using gclient to pull the third-party dependencies, which is
564+
# done by the `v8` target.
533565
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
534566
--mode=$(BUILDTYPE_LOWER) $(V8_TEST_OPTIONS) $(QUICKCHECK_ARG) \
535567
--no-presubmit \
@@ -540,7 +572,7 @@ test-v8: v8 ## Runs the V8 test suite on deps/v8.
540572
$(MAKE) test-hash-seed
541573

542574
test-v8-intl: v8
543-
# note: performs full test unless QUICKCHECK is specified
575+
# Performs a full test unless QUICKCHECK is specified.
544576
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
545577
--mode=$(BUILDTYPE_LOWER) --no-presubmit $(QUICKCHECK_ARG) \
546578
--shell-dir=deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) intl \
@@ -574,8 +606,7 @@ apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json))
574606
apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
575607

576608
.PHONY: doc-only
577-
# This uses the locally built node if available, otherwise uses the global node
578-
doc-only: $(apidoc_dirs) $(apiassets)
609+
doc-only: $(apidoc_dirs) $(apiassets) ## Builds the docs with the local or the global Node.js binary.
579610
# If it's a source tarball, assets are already in doc/api/assets,
580611
# no need to install anything, we have already copied the docs over
581612
if [ ! -d doc/api/assets ]; then \
@@ -639,15 +670,6 @@ docopen: $(apidocs_html)
639670
docclean:
640671
$(RM) -r out/doc
641672

642-
.PHONY: build-ci
643-
build-ci:
644-
$(PYTHON) ./configure $(CONFIG_FLAGS)
645-
$(MAKE)
646-
647-
.PHONY: run-ci
648-
run-ci: build-ci
649-
$(MAKE) test-ci
650-
651673
RAWVER=$(shell $(PYTHON) tools/getnodeversion.py)
652674
VERSION=v$(RAWVER)
653675

@@ -870,8 +892,10 @@ $(PKG): release-only
870892
SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" bash tools/osx-productsign.sh
871893

872894
.PHONY: pkg
895+
# Builds the macOS installer for releases.
873896
pkg: $(PKG)
874897

898+
# Note: this is strictly for release builds on release machines only.
875899
pkg-upload: pkg
876900
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
877901
chmod 664 $(TARNAME).pkg
@@ -905,6 +929,7 @@ endif
905929
.PHONY: tar
906930
tar: $(TARBALL) ## Create a source tarball.
907931

932+
# Note: this is strictly for release builds on release machines only.
908933
tar-upload: tar
909934
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
910935
chmod 664 $(TARNAME).tar.gz
@@ -916,6 +941,7 @@ ifeq ($(XZ), 0)
916941
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).tar.xz.done"
917942
endif
918943

944+
# Note: this is strictly for release builds on release machines only.
919945
doc-upload: doc
920946
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs/"
921947
chmod -R ug=rw-x+X,o=r+X out/doc/
@@ -978,8 +1004,10 @@ endif
9781004
$(RM) $(BINARYNAME).tar
9791005

9801006
.PHONY: binary
1007+
# This requires NODE_VERSION_IS_RELEASE defined as 1 in src/node_version.h.
9811008
binary: $(BINARYTAR) ## Build release binary tarballs.
9821009

1010+
# Note: this is strictly for release builds on release machines only.
9831011
binary-upload: binary
9841012
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
9851013
chmod 664 $(TARNAME)-$(OSTYPE)-$(ARCH).tar.gz
@@ -1038,7 +1066,7 @@ bench-dgram: all
10381066
bench-all: bench bench-misc bench-array bench-buffer bench-url bench-events bench-dgram bench-util
10391067

10401068
.PHONY: bench
1041-
bench: bench-net bench-http bench-fs bench-tls ## Run node benchmarks.
1069+
bench: bench-net bench-http bench-fs bench-tls
10421070

10431071
.PHONY: bench-ci
10441072
bench-ci: bench
@@ -1078,6 +1106,7 @@ tools/.miscmdlintstamp: $(LINT_MD_FILES)
10781106

10791107
tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp
10801108

1109+
# Lints the markdown documents maintained by us in the codebase.
10811110
lint-md: | tools/.mdlintstamp
10821111
else
10831112
lint-md:
@@ -1099,6 +1128,8 @@ lint-js-fix:
10991128
fi
11001129

11011130
.PHONY: lint-js
1131+
# Note that on the CI `lint-js-ci` is run instead.
1132+
# Lints the JavaScript code with eslint.
11021133
lint-js:
11031134
@echo "Running JS linter..."
11041135
@if [ -x $(NODE) ]; then \
@@ -1111,6 +1142,7 @@ jslint: lint-js
11111142
@echo "Please use lint-js instead of jslint"
11121143

11131144
.PHONY: lint-js-ci
1145+
# On the CI the output is emitted in the TAP format.
11141146
lint-js-ci:
11151147
@echo "Running JS linter..."
11161148
@if [ -x $(NODE) ]; then \
@@ -1156,6 +1188,7 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \
11561188
ADDON_DOC_LINT_FLAGS=-whitespace/ending_newline,-build/header_guard
11571189

11581190
.PHONY: lint-cpp
1191+
# Lints the C++ code with cpplint.py and check-imports.py.
11591192
lint-cpp: tools/.cpplintstamp
11601193

11611194
tools/.cpplintstamp: $(LINT_CPP_FILES)
@@ -1181,6 +1214,8 @@ lint: ## Run JS, C++, MD and doc linters.
11811214
$(MAKE) lint-addon-docs || EXIT_STATUS=$$? ; \
11821215
exit $$EXIT_STATUS
11831216
CONFLICT_RE=^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+
1217+
1218+
# Related CI job: node-test-linter
11841219
lint-ci: lint-js-ci lint-cpp lint-md lint-addon-docs
11851220
@if ! ( grep -IEqrs "$(CONFLICT_RE)" benchmark deps doc lib src test tools ) \
11861221
&& ! ( find . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \

0 commit comments

Comments
 (0)