Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4bb27a2

Browse filesBrowse files
gibfahnMylesBorins
authored andcommitted
build: add a make help option for common targets
PR-URL: #17323 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent f3d6198 commit 4bb27a2
Copy full SHA for 4bb27a2

File tree

Expand file treeCollapse file tree

1 file changed

+21
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+21
-14
lines changed
Open diff view settings
Collapse file

‎Makefile‎

Copy file name to clipboardExpand all lines: Makefile
+21-14Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,17 @@ V ?= 1
6363
# BUILDTYPE=Debug builds both release and debug builds. If you want to compile
6464
# just the debug build, run `make -C out BUILDTYPE=Debug` instead.
6565
ifeq ($(BUILDTYPE),Release)
66-
all: out/Makefile $(NODE_EXE)
66+
all: out/Makefile $(NODE_EXE) ## Default target, builds node in out/Release/node.
6767
else
6868
all: out/Makefile $(NODE_EXE) $(NODE_G_EXE)
6969
endif
7070

71+
# To add a target to the help, add a double comment (##) on the target line.
72+
help: ## Print help for targets with comments.
73+
@printf "For more targets and info see the comments in the Makefile.\n\n"
74+
@grep -E '^[a-zA-Z0-9._-]+:.*?## .*$$' Makefile | sort | \
75+
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
76+
7177
# The .PHONY is needed to ensure that we recursively use the out/Makefile
7278
# to check for changes.
7379
.PHONY: $(NODE_EXE) $(NODE_G_EXE)
@@ -94,13 +100,13 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \
94100
config.gypi: configure
95101
$(error Missing or stale $@, please run ./$<)
96102

97-
install: all
103+
install: all ## Installs node into $PREFIX (default=/usr/local).
98104
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
99105

100-
uninstall:
106+
uninstall: ## Uninstalls node from $PREFIX (default=/usr/local).
101107
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
102108

103-
clean:
109+
clean: ## Remove build artifacts.
104110
$(RM) -r out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \
105111
out/$(BUILDTYPE)/node.exp
106112
@if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs $(RM) -r; fi
@@ -145,7 +151,7 @@ coverage-clean:
145151
# For C++ coverage reporting, this needs to be run in conjunction with configure
146152
# --coverage. html coverage reports will be created under coverage/
147153

148-
coverage: coverage-test
154+
coverage: coverage-test ## Run the tests and generate a coverage report.
149155

150156
coverage-build: all
151157
mkdir -p node_modules
@@ -205,7 +211,7 @@ v8:
205211
tools/make-v8.sh
206212
$(MAKE) -C deps/v8 $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
207213

208-
test: all
214+
test: all ## Default test target. Runs default tests, linters, and builds docs.
209215
$(MAKE) -s build-addons
210216
$(MAKE) -s build-addons-napi
211217
$(MAKE) -s doc-only
@@ -373,7 +379,7 @@ test-build: | all build-addons build-addons-napi
373379

374380
test-build-addons-napi: all build-addons-napi
375381

376-
test-all: test-build test/gc/build/Release/binding.node
382+
test-all: test-build test/gc/build/Release/binding.node ## Run everything in test/.
377383
$(PYTHON) tools/test.py --mode=debug,release
378384

379385
test-all-valgrind: test-build
@@ -452,7 +458,7 @@ test-doc: doc-only
452458
test-known-issues: all
453459
$(PYTHON) tools/test.py known_issues
454460

455-
test-npm: $(NODE_EXE)
461+
test-npm: $(NODE_EXE) ## Run the npm test suite on deps/npm.
456462
$(NODE) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test-node
457463

458464
test-npm-publish: $(NODE_EXE)
@@ -494,7 +500,7 @@ test-with-async-hooks:
494500

495501

496502
ifneq ("","$(wildcard deps/v8/tools/run-tests.py)")
497-
test-v8: v8
503+
test-v8: v8 ## Runs the V8 test suite on deps/v8.
498504
# note: performs full test unless QUICKCHECK is specified
499505
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
500506
--mode=$(BUILDTYPE_LOWER) $(V8_TEST_OPTIONS) $(QUICKCHECK_ARG) \
@@ -860,7 +866,7 @@ ifeq ($(XZ), 0)
860866
endif
861867
$(RM) $(TARNAME).tar
862868

863-
tar: $(TARBALL)
869+
tar: $(TARBALL) ## Create a source tarball.
864870

865871
tar-upload: tar
866872
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
@@ -896,7 +902,7 @@ ifeq ($(XZ), 0)
896902
endif
897903
$(RM) $(TARNAME)-headers.tar
898904

899-
tar-headers: $(TARBALL)-headers
905+
tar-headers: $(TARBALL)-headers ## Build the node header tarball.
900906

901907
tar-headers-upload: tar-headers
902908
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
@@ -933,7 +939,7 @@ ifeq ($(XZ), 0)
933939
endif
934940
$(RM) $(BINARYNAME).tar
935941

936-
binary: $(BINARYTAR)
942+
binary: $(BINARYTAR) ## Build release binary tarballs.
937943

938944
binary-upload: binary
939945
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
@@ -984,7 +990,7 @@ bench-dgram: all
984990

985991
bench-all: bench bench-misc bench-array bench-buffer bench-url bench-events bench-dgram bench-util
986992

987-
bench: bench-net bench-http bench-fs bench-tls
993+
bench: bench-net bench-http bench-fs bench-tls ## Run node benchmarks.
988994

989995
bench-ci: bench
990996

@@ -1110,7 +1116,7 @@ cpplint: lint-cpp
11101116
@echo "Please use lint-cpp instead of cpplint"
11111117

11121118
ifneq ("","$(wildcard tools/eslint/)")
1113-
lint:
1119+
lint: ## Run JS, C++, MD and doc linters.
11141120
@EXIT_STATUS=0 ; \
11151121
$(MAKE) lint-js || EXIT_STATUS=$$? ; \
11161122
$(MAKE) lint-cpp || EXIT_STATUS=$$? ; \
@@ -1176,6 +1182,7 @@ lint-clean:
11761182
docclean \
11771183
docopen \
11781184
dynamiclib \
1185+
help \
11791186
install \
11801187
install-bin \
11811188
install-includes \

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.