build: put .PHONY directly before its target
Before this change, the .PHONY is followed by multiple targets. Now it is multiple .PHONY for each target. PR-URL: https://github.com/nodejs/node/pull/17964 Refs: https://github.com/nodejs/node/issues/16968 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
254c80deca
commit
feaf6ac3dc
145
Makefile
145
Makefile
@ -60,6 +60,7 @@ BUILD_RELEASE_FLAGS ?= $(BUILD_DOWNLOAD_FLAGS) $(BUILD_INTL_FLAGS)
|
||||
# or set the V environment variable to an empty string.
|
||||
V ?= 1
|
||||
|
||||
.PHONY: all
|
||||
# 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)
|
||||
@ -68,6 +69,7 @@ else
|
||||
all: out/Makefile $(NODE_EXE) $(NODE_G_EXE)
|
||||
endif
|
||||
|
||||
.PHONY: help
|
||||
# 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"
|
||||
@ -100,12 +102,15 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \
|
||||
config.gypi: configure
|
||||
$(error Missing or stale $@, please run ./$<)
|
||||
|
||||
.PHONY: install
|
||||
install: all ## Installs node into $PREFIX (default=/usr/local).
|
||||
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall: ## Uninstalls node from $PREFIX (default=/usr/local).
|
||||
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
|
||||
|
||||
.PHONY: clean
|
||||
clean: ## Remove build artifacts.
|
||||
$(RM) -r out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \
|
||||
out/$(BUILDTYPE)/node.exp
|
||||
@ -118,6 +123,7 @@ clean: ## Remove build artifacts.
|
||||
$(RM) -r test/.tmp*
|
||||
$(MAKE) test-addons-clean
|
||||
|
||||
.PHONY: distclean
|
||||
distclean:
|
||||
$(RM) -r out
|
||||
$(RM) config.gypi icu_config.gypi config_fips.gypi
|
||||
@ -129,8 +135,10 @@ distclean:
|
||||
$(RM) $(BINARYTAR).* $(TARBALL).*
|
||||
$(RM) -r deps/v8/testing/gmock
|
||||
|
||||
.PHONY: check
|
||||
check: test
|
||||
|
||||
.PHONY: coverage-clean
|
||||
# Remove files generated by running coverage, put the non-instrumented lib back
|
||||
# in place
|
||||
coverage-clean:
|
||||
@ -146,13 +154,14 @@ coverage-clean:
|
||||
$(RM) out/$(BUILDTYPE)/obj.target/cctest/src/*.gcno
|
||||
$(RM) out/$(BUILDTYPE)/obj.target/cctest/test/cctest/*.gcno
|
||||
|
||||
.PHONY: coverage
|
||||
# Build and test with code coverage reporting. Leave the lib directory
|
||||
# instrumented for any additional runs the user may want to make.
|
||||
# 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 ## Run the tests and generate a coverage report.
|
||||
|
||||
.PHONY: coverage-build
|
||||
coverage-build: all
|
||||
mkdir -p node_modules
|
||||
if [ ! -d node_modules/istanbul-merge ]; then \
|
||||
@ -171,6 +180,7 @@ coverage-build: all
|
||||
$(NODE) ./node_modules/.bin/nyc instrument --extension .js --extension .mjs lib_/ lib/
|
||||
$(MAKE)
|
||||
|
||||
.PHONY: coverage-test
|
||||
coverage-test: coverage-build
|
||||
$(RM) -r out/$(BUILDTYPE)/.coverage
|
||||
$(RM) -r .cov_tmp
|
||||
@ -198,19 +208,23 @@ coverage-test: coverage-build
|
||||
@grep -A3 Lines coverage/cxxcoverage.html | grep style \
|
||||
| sed 's/<[^>]*>//g'| sed 's/ //g'
|
||||
|
||||
.PHONY: cctest
|
||||
cctest: all
|
||||
@out/$(BUILDTYPE)/$@ --gtest_filter=$(GTEST_FILTER)
|
||||
|
||||
.PHONY: list-gtests
|
||||
list-gtests:
|
||||
ifeq (,$(wildcard out/$(BUILDTYPE)/cctest))
|
||||
$(error Please run 'make cctest' first)
|
||||
endif
|
||||
@out/$(BUILDTYPE)/cctest --gtest_list_tests
|
||||
|
||||
.PHONY: v8
|
||||
v8:
|
||||
tools/make-v8.sh
|
||||
$(MAKE) -C deps/v8 $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
|
||||
|
||||
.PHONY: test
|
||||
test: all ## Default test target. Runs default tests, linters, and builds docs.
|
||||
$(MAKE) -s build-addons
|
||||
$(MAKE) -s build-addons-napi
|
||||
@ -222,6 +236,7 @@ test: all ## Default test target. Runs default tests, linters, and builds docs.
|
||||
$(CI_NATIVE_SUITES) \
|
||||
$(CI_DOC)
|
||||
|
||||
.PHONY: test-only
|
||||
# For a quick test, does not run linter or build doc
|
||||
test-only: all
|
||||
$(MAKE) build-addons
|
||||
@ -310,6 +325,7 @@ test/addons/.buildstamp: config.gypi \
|
||||
done
|
||||
touch $@
|
||||
|
||||
.PHONY: build-addons
|
||||
# .buildstamp needs $(NODE_EXE) but cannot depend on it
|
||||
# directly because it calls make recursively. The parent make cannot know
|
||||
# if the subprocess touched anything so it pessimistically assumes that
|
||||
@ -349,6 +365,7 @@ test/addons-napi/.buildstamp: config.gypi \
|
||||
done
|
||||
touch $@
|
||||
|
||||
.PHONY: build-addons-napi
|
||||
# .buildstamp needs $(NODE_EXE) but cannot depend on it
|
||||
# directly because it calls make recursively. The parent make cannot know
|
||||
# if the subprocess touched anything so it pessimistically assumes that
|
||||
@ -357,6 +374,7 @@ test/addons-napi/.buildstamp: config.gypi \
|
||||
# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
|
||||
build-addons-napi: | $(NODE_EXE) test/addons-napi/.buildstamp
|
||||
|
||||
.PHONY: clear-stalled
|
||||
clear-stalled:
|
||||
# Clean up any leftover processes but don't error if found.
|
||||
ps awwx | grep Release/node | grep -v grep | cat
|
||||
@ -365,9 +383,11 @@ clear-stalled:
|
||||
echo $${PS_OUT} | xargs kill; \
|
||||
fi
|
||||
|
||||
.PHONY: test-gc
|
||||
test-gc: all test/gc/build/Release/binding.node
|
||||
$(PYTHON) tools/test.py --mode=release gc
|
||||
|
||||
.PHONY: test-gc-clean
|
||||
test-gc-clean:
|
||||
$(RM) -r test/gc/build
|
||||
|
||||
@ -375,6 +395,7 @@ test-build: | all build-addons build-addons-napi
|
||||
|
||||
test-build-addons-napi: all build-addons-napi
|
||||
|
||||
.PHONY: test-all
|
||||
test-all: test-build test/gc/build/Release/binding.node ## Run everything in test/.
|
||||
$(PYTHON) tools/test.py --mode=debug,release
|
||||
|
||||
@ -385,6 +406,7 @@ CI_NATIVE_SUITES ?= addons addons-napi
|
||||
CI_JS_SUITES ?= default
|
||||
CI_DOC := doctool
|
||||
|
||||
.PHONY: test-ci-native
|
||||
# Build and test addons without building anything else
|
||||
test-ci-native: LOGLEVEL := info
|
||||
test-ci-native: | test/addons/.buildstamp test/addons-napi/.buildstamp
|
||||
@ -392,6 +414,7 @@ test-ci-native: | test/addons/.buildstamp test/addons-napi/.buildstamp
|
||||
--mode=release --flaky-tests=$(FLAKY_TESTS) \
|
||||
$(TEST_CI_ARGS) $(CI_NATIVE_SUITES)
|
||||
|
||||
.PHONY: test-ci-js
|
||||
# This target should not use a native compiler at all
|
||||
test-ci-js: | clear-stalled
|
||||
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
|
||||
@ -404,6 +427,7 @@ test-ci-js: | clear-stalled
|
||||
echo $${PS_OUT} | xargs kill; exit 1; \
|
||||
fi
|
||||
|
||||
.PHONY: test-ci
|
||||
test-ci: LOGLEVEL := info
|
||||
test-ci: | clear-stalled build-addons build-addons-napi doc-only
|
||||
out/Release/cctest --gtest_output=tap:cctest.tap
|
||||
@ -442,9 +466,11 @@ test-node-inspect: $(NODE_EXE)
|
||||
test-tick-processor: all
|
||||
$(PYTHON) tools/test.py tick-processor
|
||||
|
||||
.PHONY: test-hash-seed
|
||||
test-hash-seed: all
|
||||
$(NODE) test/pummel/test-hash-seed.js
|
||||
|
||||
.PHONY: test-doc
|
||||
test-doc: doc-only
|
||||
$(MAKE) lint
|
||||
$(PYTHON) tools/test.py $(CI_DOC)
|
||||
@ -458,16 +484,20 @@ test-npm: $(NODE_EXE) ## Run the npm test suite on deps/npm.
|
||||
test-npm-publish: $(NODE_EXE)
|
||||
npm_package_config_publishtest=true $(NODE) deps/npm/test/run.js
|
||||
|
||||
.PHONY: test-addons-napi
|
||||
test-addons-napi: test-build-addons-napi
|
||||
$(PYTHON) tools/test.py --mode=release addons-napi
|
||||
|
||||
.PHONY: test-addons-napi-clean
|
||||
test-addons-napi-clean:
|
||||
$(RM) -r test/addons-napi/*/build
|
||||
$(RM) test/addons-napi/.buildstamp
|
||||
|
||||
.PHONY: test-addons
|
||||
test-addons: test-build test-addons-napi
|
||||
$(PYTHON) tools/test.py --mode=release addons
|
||||
|
||||
.PHONY: test-addons-clean
|
||||
test-addons-clean:
|
||||
$(RM) -r test/addons/??_*/
|
||||
$(RM) -r test/addons/*/build
|
||||
@ -493,6 +523,10 @@ test-with-async-hooks:
|
||||
$(CI_NATIVE_SUITES)
|
||||
|
||||
|
||||
.PHONY: test-v8
|
||||
.PHONY: test-v8-all
|
||||
.PHONY: test-v8-benchmarks
|
||||
.PHONY: test-v8-intl
|
||||
ifneq ("","$(wildcard deps/v8/tools/run-tests.py)")
|
||||
test-v8: v8 ## Runs the V8 test suite on deps/v8.
|
||||
# note: performs full test unless QUICKCHECK is specified
|
||||
@ -539,6 +573,7 @@ apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json))
|
||||
|
||||
apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
|
||||
|
||||
.PHONY: doc-only
|
||||
# This uses the locally built node if available, otherwise uses the global node
|
||||
doc-only: $(apidoc_dirs) $(apiassets)
|
||||
# If it's a source tarball, assets are already in doc/api/assets,
|
||||
@ -548,6 +583,7 @@ doc-only: $(apidoc_dirs) $(apiassets)
|
||||
fi;
|
||||
@$(MAKE) -s $(apidocs_html) $(apidocs_json)
|
||||
|
||||
.PHONY: doc
|
||||
doc: $(NODE_EXE) doc-only
|
||||
|
||||
out/doc:
|
||||
@ -595,16 +631,20 @@ out/doc/api/%.json: doc/api/%.md
|
||||
out/doc/api/%.html: doc/api/%.md
|
||||
$(call available-node, $(gen-html))
|
||||
|
||||
.PHONY: docopen
|
||||
docopen: $(apidocs_html)
|
||||
@$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html
|
||||
|
||||
.PHONY: docclean
|
||||
docclean:
|
||||
$(RM) -r out/doc
|
||||
|
||||
.PHONY: build-ci
|
||||
build-ci:
|
||||
$(PYTHON) ./configure $(CONFIG_FLAGS)
|
||||
$(MAKE)
|
||||
|
||||
.PHONY: run-ci
|
||||
run-ci: build-ci
|
||||
$(MAKE) test-ci
|
||||
|
||||
@ -745,6 +785,7 @@ XZ_COMPRESSION ?= 9e
|
||||
PKG=$(TARNAME).pkg
|
||||
MACOSOUTDIR=out/macos
|
||||
|
||||
.PHONY: release-only
|
||||
release-only:
|
||||
@if [ "$(DISTTYPE)" != "nightly" ] && [ "$(DISTTYPE)" != "next-nightly" ] && \
|
||||
`grep -q REPLACEME doc/api/*.md`; then \
|
||||
@ -828,6 +869,7 @@ $(PKG): release-only
|
||||
--package-path $(MACOSOUTDIR)/pkgs ./$(PKG)
|
||||
SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" bash tools/osx-productsign.sh
|
||||
|
||||
.PHONY: pkg
|
||||
pkg: $(PKG)
|
||||
|
||||
pkg-upload: pkg
|
||||
@ -860,6 +902,7 @@ ifeq ($(XZ), 0)
|
||||
endif
|
||||
$(RM) $(TARNAME).tar
|
||||
|
||||
.PHONY: tar
|
||||
tar: $(TARBALL) ## Create a source tarball.
|
||||
|
||||
tar-upload: tar
|
||||
@ -879,6 +922,7 @@ doc-upload: doc
|
||||
scp -pr out/doc/* $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs/
|
||||
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs.done"
|
||||
|
||||
.PHONY: $(TARBALL)-headers
|
||||
$(TARBALL)-headers: release-only
|
||||
$(PYTHON) ./configure \
|
||||
--prefix=/ \
|
||||
@ -933,6 +977,7 @@ ifeq ($(XZ), 0)
|
||||
endif
|
||||
$(RM) $(BINARYNAME).tar
|
||||
|
||||
.PHONY: binary
|
||||
binary: $(BINARYTAR) ## Build release binary tarballs.
|
||||
|
||||
binary-upload: binary
|
||||
@ -946,27 +991,34 @@ ifeq ($(XZ), 0)
|
||||
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-$(OSTYPE)-$(ARCH).tar.xz.done"
|
||||
endif
|
||||
|
||||
.PHONY: bench-net
|
||||
bench-net: all
|
||||
@$(NODE) benchmark/run.js net
|
||||
|
||||
bench-crypto: all
|
||||
@$(NODE) benchmark/run.js crypto
|
||||
|
||||
.PHONY: bench-tls
|
||||
bench-tls: all
|
||||
@$(NODE) benchmark/run.js tls
|
||||
|
||||
.PHONY: bench-http
|
||||
bench-http: all
|
||||
@$(NODE) benchmark/run.js http
|
||||
|
||||
.PHONY: bench-fs
|
||||
bench-fs: all
|
||||
@$(NODE) benchmark/run.js fs
|
||||
|
||||
.PHONY: bench-misc
|
||||
bench-misc: benchmark/misc/function_call/build/Release/binding.node
|
||||
@$(NODE) benchmark/run.js misc
|
||||
|
||||
.PHONY: bench-array
|
||||
bench-array: all
|
||||
@$(NODE) benchmark/run.js arrays
|
||||
|
||||
.PHONY: bench-buffer
|
||||
bench-buffer: all
|
||||
@$(NODE) benchmark/run.js buffers
|
||||
|
||||
@ -982,17 +1034,22 @@ bench-util: all
|
||||
bench-dgram: all
|
||||
@$(NODE) benchmark/run.js dgram
|
||||
|
||||
.PHONY: bench-all
|
||||
bench-all: bench bench-misc bench-array bench-buffer bench-url bench-events bench-dgram bench-util
|
||||
|
||||
.PHONY: bench
|
||||
bench: bench-net bench-http bench-fs bench-tls ## Run node benchmarks.
|
||||
|
||||
.PHONY: bench-ci
|
||||
bench-ci: bench
|
||||
|
||||
.PHONY: lint-md-clean
|
||||
lint-md-clean:
|
||||
$(RM) -r tools/remark-cli/node_modules
|
||||
$(RM) -r tools/remark-preset-lint-node/node_modules
|
||||
$(RM) tools/.*mdlintstamp
|
||||
|
||||
.PHONY: lint-md-build
|
||||
lint-md-build:
|
||||
@if [ ! -d tools/remark-cli/node_modules ]; then \
|
||||
echo "Markdown linter: installing remark-cli into tools/"; \
|
||||
@ -1001,6 +1058,7 @@ lint-md-build:
|
||||
echo "Markdown linter: installing remark-preset-lint-node into tools/"; \
|
||||
cd tools/remark-preset-lint-node && ../../$(NODE) ../../$(NPM) install; fi
|
||||
|
||||
.PHONY: lint-md
|
||||
ifneq ("","$(wildcard tools/remark-cli/node_modules/)")
|
||||
LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu
|
||||
LINT_MD_ROOT_DOCS := $(wildcard *.md)
|
||||
@ -1032,6 +1090,7 @@ LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \
|
||||
--rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
|
||||
$(LINT_JS_TARGETS)
|
||||
|
||||
.PHONY: lint-js-fix
|
||||
lint-js-fix:
|
||||
@if [ -x $(NODE) ]; then \
|
||||
$(NODE) $(LINT_JS_CMD) --fix; \
|
||||
@ -1039,6 +1098,7 @@ lint-js-fix:
|
||||
node $(LINT_JS_CMD) --fix; \
|
||||
fi
|
||||
|
||||
.PHONY: lint-js
|
||||
lint-js:
|
||||
@echo "Running JS linter..."
|
||||
@if [ -x $(NODE) ]; then \
|
||||
@ -1050,6 +1110,7 @@ lint-js:
|
||||
jslint: lint-js
|
||||
@echo "Please use lint-js instead of jslint"
|
||||
|
||||
.PHONY: lint-js-ci
|
||||
lint-js-ci:
|
||||
@echo "Running JS linter..."
|
||||
@if [ -x $(NODE) ]; then \
|
||||
@ -1094,6 +1155,7 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \
|
||||
# and the actual filename is generated so it won't match header guards
|
||||
ADDON_DOC_LINT_FLAGS=-whitespace/ending_newline,-build/header_guard
|
||||
|
||||
.PHONY: lint-cpp
|
||||
lint-cpp: tools/.cpplintstamp
|
||||
|
||||
tools/.cpplintstamp: $(LINT_CPP_FILES)
|
||||
@ -1109,6 +1171,8 @@ lint-addon-docs: test/addons/.docbuildstamp
|
||||
cpplint: lint-cpp
|
||||
@echo "Please use lint-cpp instead of cpplint"
|
||||
|
||||
.PHONY: lint
|
||||
.PHONY: lint-ci
|
||||
ifneq ("","$(wildcard tools/eslint/)")
|
||||
lint: ## Run JS, C++, MD and doc linters.
|
||||
@EXIT_STATUS=0 ; \
|
||||
@ -1135,84 +1199,7 @@ lint:
|
||||
lint-ci: lint
|
||||
endif
|
||||
|
||||
.PHONY: lint-clean
|
||||
lint-clean:
|
||||
$(RM) tools/.*lintstamp
|
||||
$(RM) .eslintcache
|
||||
|
||||
.PHONY: $(TARBALL)-headers \
|
||||
all \
|
||||
bench \
|
||||
bench \
|
||||
bench-all \
|
||||
bench-array \
|
||||
bench-buffer \
|
||||
bench-ci \
|
||||
bench-fs \
|
||||
bench-http \
|
||||
bench-http-simple \
|
||||
bench-idle \
|
||||
bench-misc \
|
||||
bench-net \
|
||||
bench-tls \
|
||||
binary \
|
||||
blog \
|
||||
blogclean \
|
||||
build-addons \
|
||||
build-addons-napi \
|
||||
build-ci \
|
||||
cctest \
|
||||
check \
|
||||
clean \
|
||||
clear-stalled \
|
||||
coverage \
|
||||
coverage-build \
|
||||
coverage-clean \
|
||||
coverage-test \
|
||||
dist \
|
||||
distclean \
|
||||
doc \
|
||||
doc-only \
|
||||
docclean \
|
||||
docopen \
|
||||
dynamiclib \
|
||||
help \
|
||||
install \
|
||||
install-bin \
|
||||
install-includes \
|
||||
lint \
|
||||
lint-clean \
|
||||
lint-ci \
|
||||
lint-cpp \
|
||||
lint-js \
|
||||
lint-js-ci \
|
||||
lint-js-fix \
|
||||
list-gtests \
|
||||
lint-md \
|
||||
lint-md-build \
|
||||
lint-md-clean \
|
||||
pkg \
|
||||
release-only \
|
||||
run-ci \
|
||||
staticlib \
|
||||
tar \
|
||||
test \
|
||||
test-addons \
|
||||
test-addons-clean \
|
||||
test-addons-napi \
|
||||
test-addons-napi-clean \
|
||||
test-all \
|
||||
test-ci \
|
||||
test-ci-js \
|
||||
test-ci-native \
|
||||
test-doc \
|
||||
test-gc \
|
||||
test-gc-clean \
|
||||
test-hash-seed \
|
||||
test-only \
|
||||
test-v8 \
|
||||
test-v8-all \
|
||||
test-v8-benchmarks \
|
||||
test-v8-intl \
|
||||
uninstall \
|
||||
v8 \
|
||||
website-upload
|
||||
|
Loading…
x
Reference in New Issue
Block a user