Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add a make help option for common targets #17323

Merged
merged 1 commit into from
Dec 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,17 @@ V ?= 1
# BUILDTYPE=Debug builds both release and debug builds. If you want to compile
# just the debug build, run `make -C out BUILDTYPE=Debug` instead.
ifeq ($(BUILDTYPE),Release)
all: out/Makefile $(NODE_EXE)
all: out/Makefile $(NODE_EXE) ## Default target, builds node in out/Release/node.
else
all: out/Makefile $(NODE_EXE) $(NODE_G_EXE)
endif

# To add a target to the help, add a double comment (##) on the target line.
help: ## Print help for targets with comments.
@printf "For more targets and info see the comments in the Makefile.\n\n"
@grep -E '^[a-zA-Z0-9._-]+:.*?## .*$$' Makefile | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'

# The .PHONY is needed to ensure that we recursively use the out/Makefile
# to check for changes.
.PHONY: $(NODE_EXE) $(NODE_G_EXE)
Expand All @@ -94,13 +100,13 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \
config.gypi: configure
$(error Missing or stale $@, please run ./$<)

install: all
install: all ## Installs node into $PREFIX (default=/usr/local).
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'

uninstall:
uninstall: ## Uninstalls node from $PREFIX (default=/usr/local).
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'

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

coverage: coverage-test
coverage: coverage-test ## Run the tests and generate a coverage report.

coverage-build: all
mkdir -p node_modules
Expand Down Expand Up @@ -205,7 +211,7 @@ v8:
tools/make-v8.sh
$(MAKE) -C deps/v8 $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)

test: all
test: all ## Default test target. Runs default tests, linters, and builds docs.
$(MAKE) -s build-addons
$(MAKE) -s build-addons-napi
$(MAKE) -s doc-only
Expand Down Expand Up @@ -373,7 +379,7 @@ test-build: | all build-addons build-addons-napi

test-build-addons-napi: all build-addons-napi

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

test-all-valgrind: test-build
Expand Down Expand Up @@ -452,7 +458,7 @@ test-doc: doc-only
test-known-issues: all
$(PYTHON) tools/test.py known_issues

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

test-npm-publish: $(NODE_EXE)
Expand Down Expand Up @@ -494,7 +500,7 @@ test-with-async-hooks:


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

tar: $(TARBALL)
tar: $(TARBALL) ## Create a source tarball.

tar-upload: tar
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
Expand Down Expand Up @@ -896,7 +902,7 @@ ifeq ($(XZ), 0)
endif
$(RM) $(TARNAME)-headers.tar

tar-headers: $(TARBALL)-headers
tar-headers: $(TARBALL)-headers ## Build the node header tarball.

tar-headers-upload: tar-headers
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
Expand Down Expand Up @@ -933,7 +939,7 @@ ifeq ($(XZ), 0)
endif
$(RM) $(BINARYNAME).tar

binary: $(BINARYTAR)
binary: $(BINARYTAR) ## Build release binary tarballs.

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

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

bench: bench-net bench-http bench-fs bench-tls
bench: bench-net bench-http bench-fs bench-tls ## Run node benchmarks.

bench-ci: bench

Expand Down Expand Up @@ -1110,7 +1116,7 @@ cpplint: lint-cpp
@echo "Please use lint-cpp instead of cpplint"

ifneq ("","$(wildcard tools/eslint/)")
lint:
lint: ## Run JS, C++, MD and doc linters.
@EXIT_STATUS=0 ; \
$(MAKE) lint-js || EXIT_STATUS=$$? ; \
$(MAKE) lint-cpp || EXIT_STATUS=$$? ; \
Expand Down Expand Up @@ -1176,6 +1182,7 @@ lint-clean:
docclean \
docopen \
dynamiclib \
help \
install \
install-bin \
install-includes \
Expand Down