Skip to content

Commit

Permalink
tools: add missing .PHONY and .NOTPARALLEL targets in Makefile
Browse files Browse the repository at this point in the history
PR-URL: #41515
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yash Ladha <yash@yashladha.in>
  • Loading branch information
aduh95 authored and danielleadams committed Mar 14, 2022
1 parent 1e3c9eb commit 7cbc472
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ uninstall: ## Uninstalls node from $PREFIX (default=/usr/local).
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'

.PHONY: clean
.NOTPARALLEL: clean
clean: ## Remove build artifacts.
$(RM) -r out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \
out/$(BUILDTYPE)/node.exp
Expand All @@ -183,12 +184,14 @@ clean: ## Remove build artifacts.
$(MAKE) bench-addons-clean

.PHONY: testclean
.NOTPARALLEL: testclean
testclean:
# Next one is legacy remove this at some point
$(RM) -r test/tmp*
$(RM) -r test/.tmp*

.PHONY: distclean
.NOTPARALLEL: distclean
distclean:
$(RM) -r out
$(RM) config.gypi icu_config.gypi config_fips.gypi
Expand All @@ -203,6 +206,7 @@ distclean:
check: test

.PHONY: coverage-clean
.NOTPARALLEL: coverage-clean
# Remove files generated by running coverage, put the non-instrumented lib back
# in place
coverage-clean:
Expand Down Expand Up @@ -316,19 +320,23 @@ test-only: all ## For a quick test, does not run linter or build docs.
$(MAKE) tooltest

# Used by `make coverage-test`
.PHONY: test-cov
test-cov: all
$(MAKE) build-addons
$(MAKE) build-js-native-api-tests
$(MAKE) build-node-api-tests
$(MAKE) cctest
CI_SKIP_TESTS=$(COV_SKIP_TESTS) $(MAKE) jstest

.PHONY: test-parallel
test-parallel: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) parallel

.PHONY: test-valgrind
test-valgrind: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --valgrind sequential parallel message

.PHONY: test-check-deopts
test-check-deopts: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --check-deopts parallel sequential

Expand Down Expand Up @@ -457,16 +465,20 @@ clear-stalled:
echo $${PS_OUT} | xargs kill -9; \
fi

.PHONY: test-build
test-build: | all build-addons build-js-native-api-tests build-node-api-tests

.PHONY: test-build-js-native-api
test-build-js-native-api: all build-js-native-api-tests

.PHONY: test-build-node-api
test-build-node-api: all build-node-api-tests

.PHONY: test-all
test-all: test-build ## Run default tests with both Debug and Release builds.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug,release

.PHONY: test-all-valgrind
test-all-valgrind: test-build
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug,release --valgrind

Expand Down Expand Up @@ -544,30 +556,39 @@ build-ci:
run-ci: build-ci
$(MAKE) test-ci -j1

.PHONY: test-release
test-release: test-build
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER)

.PHONY: test-debug
test-debug: test-build
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug

.PHONY: test-message
test-message: test-build
$(PYTHON) tools/test.py $(PARALLEL_ARGS) message

.PHONY: test-wpt
test-wpt: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) wpt

.PHONY: test-simple
test-simple: | cctest # Depends on 'all'.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) parallel sequential

.PHONY: test-pummel
test-pummel: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) pummel

.PHONY: test-internet
test-internet: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) internet

.PHONY: test-benchmark
test-benchmark: | bench-addons-build
$(PYTHON) tools/test.py $(PARALLEL_ARGS) benchmark

.PHONY: test-tick-processor
test-tick-processor: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) tick-processor

Expand All @@ -588,13 +609,16 @@ test-doc: doc-only lint-md ## Builds, lints, and verifies the docs.
test-doc-ci: doc-only
$(PYTHON) tools/test.py --shell $(NODE) $(TEST_CI_ARGS) $(PARALLEL_ARGS) doctool

.PHONY: test-known-issues
test-known-issues: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) known_issues

# Related CI job: node-test-npm
.PHONY: test-npm
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

.PHONY: test-npm-publish
test-npm-publish: $(NODE_EXE)
npm_package_config_publishtest=true $(NODE) deps/npm/test/run.js

Expand All @@ -603,6 +627,7 @@ test-js-native-api: test-build-js-native-api
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) js-native-api

.PHONY: test-js-native-api-clean
.NOTPARALLEL: test-js-native-api-clean
test-js-native-api-clean:
$(RM) -r test/js-native-api/*/build
$(RM) test/js-native-api/.buildstamp
Expand All @@ -612,6 +637,7 @@ test-node-api: test-build-node-api
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) node-api

.PHONY: test-node-api-clean
.NOTPARALLEL: test-node-api-clean
test-node-api-clean:
$(RM) -r test/node-api/*/build
$(RM) test/node-api/.buildstamp
Expand All @@ -621,16 +647,19 @@ test-addons: test-build test-js-native-api test-node-api
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons

.PHONY: test-addons-clean
.NOTPARALLEL: test-addons-clean
test-addons-clean:
$(RM) -r test/addons/??_*/
$(RM) -r test/addons/*/build
$(RM) test/addons/.buildstamp test/addons/.docbuildstamp
$(MAKE) test-js-native-api-clean
$(MAKE) test-node-api-clean

.PHONY: test-async-hooks
test-async-hooks:
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) async-hooks

.PHONY: test-with-async-hooks
test-with-async-hooks:
$(MAKE) build-addons
$(MAKE) build-js-native-api-tests
Expand Down Expand Up @@ -783,6 +812,7 @@ docserve: $(apidocs_html) $(apiassets)
@$(PYTHON) -m http.server 8000 --bind 127.0.0.1 --directory out/doc/api

.PHONY: docclean
.NOTPARALLEL: docclean
docclean:
$(RM) -r out/doc
$(RM) "$(VERSIONS_DATA)"
Expand Down Expand Up @@ -951,6 +981,7 @@ XZ_COMPRESSION ?= 9e
PKG=$(TARNAME).pkg
MACOSOUTDIR=out/macos

.PHONY: check-xz
ifeq ($(SKIP_XZ), 1)
check-xz:
$(info SKIP_XZ=1 supplied, skipping .tar.xz creation)
Expand Down Expand Up @@ -1086,6 +1117,7 @@ endif
# Builds the macOS installer for releases.
pkg: $(PKG)

.PHONY: corepack-update
corepack-update:
rm -rf /tmp/node-corepack-clone
git clone 'https://github.com/nodejs/corepack.git' /tmp/node-corepack-clone
Expand All @@ -1094,6 +1126,7 @@ corepack-update:
cd deps/corepack && tar xf /tmp/node-corepack-clone/package.tgz --strip-components=1
chmod +x deps/corepack/shims/*

.PHONY: pkg-upload
# Note: this is strictly for release builds on release machines only.
pkg-upload: pkg
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
Expand Down Expand Up @@ -1142,6 +1175,7 @@ endif
.PHONY: tar
tar: $(TARBALL) ## Create a source tarball.

.PHONY: tar-upload
# Note: this is strictly for release builds on release machines only.
tar-upload: tar
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
Expand All @@ -1154,6 +1188,7 @@ ifeq ($(XZ), 1)
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).tar.xz.done"
endif

.PHONY: doc-upload
# Note: this is strictly for release builds on release machines only.
doc-upload: doc
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs/"
Expand All @@ -1179,8 +1214,10 @@ ifeq ($(XZ), 1)
endif
$(RM) $(TARNAME)-headers.tar

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

.PHONY: tar-headers-upload
tar-headers-upload: tar-headers
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
chmod 664 $(TARNAME)-headers.tar.gz
Expand Down Expand Up @@ -1224,6 +1261,7 @@ endif
# This requires NODE_VERSION_IS_RELEASE defined as 1 in src/node_version.h.
binary: $(BINARYTAR) ## Build release binary tarballs.

.PHONY: binary-upload
# Note: this is strictly for release builds on release machines only.
binary-upload: binary
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
Expand All @@ -1246,6 +1284,7 @@ bench bench-all: bench-addons-build
bench-addons-build: | $(NODE_EXE) benchmark/napi/.buildstamp

.PHONY: bench-addons-clean
.NOTPARALLEL: bench-addons-clean
bench-addons-clean:
$(RM) -r benchmark/napi/*/build
$(RM) benchmark/napi/.buildstamp
Expand All @@ -1256,6 +1295,7 @@ lint-md-rollup:
cd tools/lint-md && npm ci && npm run build

.PHONY: lint-md-clean
.NOTPARALLEL: lint-md-clean
lint-md-clean:
$(RM) -r tools/lint-md/node_modules
$(RM) tools/.*mdlintstamp
Expand Down Expand Up @@ -1372,9 +1412,12 @@ 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: format-cpp-build
format-cpp-build:
cd tools/clang-format && $(call available-node,$(run-npm-ci))

.PHONY: format-cpp-clean
.NOTPARALLEL: format-cpp-clean
format-cpp-clean:
$(RM) -r tools/clang-format/node_modules

Expand Down Expand Up @@ -1434,8 +1477,8 @@ lint-py-build:
$(PYTHON) -m pip install --no-user --upgrade -t tools/pip/site-packages flake8 || \
$(PYTHON) -m pip install --no-user --upgrade --system -t tools/pip/site-packages flake8

ifneq ("","$(wildcard tools/pip/site-packages/flake8)")
.PHONY: lint-py
ifneq ("","$(wildcard tools/pip/site-packages/flake8)")
# Lints the Python code with flake8.
# Flag the build if there are Python syntax errors or undefined names
lint-py:
Expand Down Expand Up @@ -1500,6 +1543,7 @@ lint-clean:

HAS_DOCKER ?= $(shell command -v docker > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)

.PHONY: gen-openssl
ifeq ($(HAS_DOCKER), 1)
DOCKER_COMMAND ?= docker run -it -v $(PWD):/node
IS_IN_WORKTREE = $(shell grep '^gitdir: ' $(PWD)/.git 2>/dev/null)
Expand Down

0 comments on commit 7cbc472

Please sign in to comment.