Skip to content

Commit 988066f

Browse files
aduh95BethGriggs
authored andcommitted
build: use make functions instead of echo
PR-URL: #35707 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent f348fca commit 988066f

File tree

1 file changed

+31
-43
lines changed

1 file changed

+31
-43
lines changed

Makefile

+31-43
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ $(NODE_G_EXE): config.gypi out/Debug/build.ninja
123123
if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Debug/$(NODE_EXE) $@; fi
124124
else
125125
$(NODE_EXE) $(NODE_G_EXE):
126-
echo This Makefile currently only supports building with 'make' or 'ninja'
126+
$(warning This Makefile currently only supports building with 'make' or 'ninja')
127127
endif
128128
endif
129129

@@ -133,12 +133,9 @@ CONFIG_FLAGS += --debug
133133
endif
134134

135135
.PHONY: with-code-cache
136-
with-code-cache:
137-
echo "'with-code-cache' target is a noop"
138-
139136
.PHONY: test-code-cache
140-
test-code-cache: with-code-cache
141-
echo "'test-code-cache' target is a noop"
137+
with-code-cache test-code-cache:
138+
$(warning '$@' target is a noop)
142139

143140
out/Makefile: config.gypi common.gypi node.gyp \
144141
deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \
@@ -468,7 +465,7 @@ benchmark/napi/.buildstamp: $(ADDONS_PREREQS) \
468465

469466
.PHONY: clear-stalled
470467
clear-stalled:
471-
@echo "Clean up any leftover processes but don't error if found."
468+
$(info Clean up any leftover processes but don't error if found.)
472469
ps awwx | grep Release/node | grep -v grep | cat
473470
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
474471
if [ "$${PS_OUT}" ]; then \
@@ -519,7 +516,7 @@ test-ci-js: | clear-stalled
519516
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
520517
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
521518
$(TEST_CI_ARGS) $(CI_JS_SUITES)
522-
@echo "Clean up any leftover processes, error if found."
519+
$(info Clean up any leftover processes, error if found.)
523520
ps awwx | grep Release/node | grep -v grep | cat
524521
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
525522
if [ "$${PS_OUT}" ]; then \
@@ -535,7 +532,7 @@ test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tes
535532
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
536533
$(TEST_CI_ARGS) $(CI_JS_SUITES) $(CI_NATIVE_SUITES) $(CI_DOC)
537534
out/Release/embedtest 'require("./test/embedding/test-embedding.js")'
538-
@echo "Clean up any leftover processes, error if found."
535+
$(info Clean up any leftover processes, error if found.)
539536
ps awwx | grep Release/node | grep -v grep | cat
540537
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
541538
if [ "$${PS_OUT}" ]; then \
@@ -672,7 +669,7 @@ test-v8: v8 ## Runs the V8 test suite on deps/v8.
672669
--mode=$(BUILDTYPE_LOWER) $(V8_TEST_OPTIONS) \
673670
mjsunit cctest debugger inspector message preparser \
674671
$(TAP_V8)
675-
@echo Testing hash seed
672+
$(info Testing hash seed)
676673
$(MAKE) test-hash-seed
677674

678675
test-v8-intl: v8
@@ -692,9 +689,8 @@ test-v8-all: test-v8 test-v8-intl test-v8-benchmarks test-v8-updates
692689
# runs all v8 tests
693690
else
694691
test-v8 test-v8-intl test-v8-benchmarks test-v8-all:
695-
@echo "Testing v8 is not available through the source tarball."
696-
@echo "Use the git repo instead:" \
697-
"$ git clone https://github.com/nodejs/node.git"
692+
$(warning Testing V8 is not available through the source tarball.)
693+
$(warning Use the git repo instead: $$ git clone https://github.com/nodejs/node.git)
698694
endif
699695

700696
apidoc_dirs = out/doc out/doc/api out/doc/api/assets
@@ -929,14 +925,13 @@ MACOSOUTDIR=out/macos
929925

930926
ifeq ($(SKIP_XZ), 1)
931927
check-xz:
932-
@echo "SKIP_XZ=1 supplied, skipping .tar.xz creation"
928+
$(info SKIP_XZ=1 supplied, skipping .tar.xz creation)
933929
else
934930
ifeq ($(HAS_XZ), 1)
935931
check-xz:
936932
else
937933
check-xz:
938-
@echo "No xz command, cannot continue"
939-
@exit 1
934+
$(error No xz command, cannot continue)
940935
endif
941936
endif
942937

@@ -1169,12 +1164,9 @@ ifeq ($(XZ), 1)
11691164
endif
11701165

11711166
.PHONY: bench-all
1172-
bench-all: bench-addons-build
1173-
@echo "Please use benchmark/run.js or benchmark/compare.js to run the benchmarks."
1174-
11751167
.PHONY: bench
1176-
bench: bench-addons-build
1177-
@echo "Please use benchmark/run.js or benchmark/compare.js to run the benchmarks."
1168+
bench bench-all: bench-addons-build
1169+
$(warning Please use benchmark/run.js or benchmark/compare.js to run the benchmarks.)
11781170

11791171
# Build required addons for benchmark before running it.
11801172
.PHONY: bench-addons-build
@@ -1198,7 +1190,7 @@ lint-md-clean:
11981190

11991191
.PHONY: lint-md-build
12001192
lint-md-build:
1201-
$(warning "Deprecated no-op target 'lint-md-build'")
1193+
$(warning Deprecated no-op target 'lint-md-build')
12021194

12031195
ifeq ("$(wildcard tools/.mdlintstamp)","")
12041196
LINT_MD_NEWER =
@@ -1213,7 +1205,7 @@ LINT_MD_FILES = $(shell $(FIND) $(LINT_MD_TARGETS) -type f \
12131205
run-lint-md = tools/lint-md.js -q -f --no-stdout $(LINT_MD_FILES)
12141206
# Lint all changed markdown files maintained by us
12151207
tools/.mdlintstamp: $(LINT_MD_FILES)
1216-
@echo "Running Markdown linter..."
1208+
$(info Running Markdown linter...)
12171209
@$(call available-node,$(run-lint-md))
12181210
@touch $@
12191211

@@ -1244,7 +1236,7 @@ lint-js:
12441236
fi
12451237

12461238
jslint: lint-js
1247-
@echo "Please use lint-js instead of jslint"
1239+
$(warning Please use lint-js instead of jslint)
12481240

12491241
run-lint-js-ci = tools/node_modules/eslint/bin/eslint.js \
12501242
--report-unused-disable-directives --ext=.js,.mjs,.md -f tap \
@@ -1253,11 +1245,11 @@ run-lint-js-ci = tools/node_modules/eslint/bin/eslint.js \
12531245
.PHONY: lint-js-ci
12541246
# On the CI the output is emitted in the TAP format.
12551247
lint-js-ci:
1256-
@echo "Running JS linter..."
1248+
$(info Running JS linter...)
12571249
@$(call available-node,$(run-lint-js-ci))
12581250

12591251
jslint-ci: lint-js-ci
1260-
@echo "Please use lint-js-ci instead of jslint-ci"
1252+
$(warning Please use lint-js-ci instead of jslint-ci)
12611253

12621254
LINT_CPP_ADDON_DOC_FILES_GLOB = test/addons/??_*/*.cc test/addons/??_*/*.h
12631255
LINT_CPP_ADDON_DOC_FILES = $(wildcard $(LINT_CPP_ADDON_DOC_FILES_GLOB))
@@ -1314,15 +1306,15 @@ CLANG_FORMAT_START ?= HEAD
13141306
# $ CLANG_FORMAT_START=master make format-cpp
13151307
format-cpp: ## Format C++ diff from $CLANG_FORMAT_START to current changes
13161308
ifneq ("","$(wildcard tools/clang-format/node_modules/)")
1317-
@echo "Formatting C++ diff from $(CLANG_FORMAT_START).."
1309+
$(info Formatting C++ diff from $(CLANG_FORMAT_START)..)
13181310
@$(PYTHON) tools/clang-format/node_modules/.bin/git-clang-format \
13191311
--binary=tools/clang-format/node_modules/.bin/clang-format \
13201312
--style=file \
13211313
$(CLANG_FORMAT_START) -- \
13221314
$(LINT_CPP_FILES)
13231315
else
1324-
@echo "clang-format is not installed."
1325-
@echo "To install (requires internet access) run: $ make format-cpp-build"
1316+
$(info clang-format is not installed.)
1317+
$(info To install (requires internet access) run: $$ make format-cpp-build)
13261318
endif
13271319

13281320
ifeq ($(V),1)
@@ -1335,7 +1327,7 @@ endif
13351327
lint-cpp: tools/.cpplintstamp
13361328

13371329
tools/.cpplintstamp: $(LINT_CPP_FILES)
1338-
@echo "Running C++ linter..."
1330+
$(info Running C++ linter...)
13391331
@$(PYTHON) tools/cpplint.py $(CPPLINT_QUIET) $?
13401332
@$(PYTHON) tools/checkimports.py $?
13411333
@touch $@
@@ -1344,19 +1336,19 @@ tools/.cpplintstamp: $(LINT_CPP_FILES)
13441336
lint-addon-docs: tools/.doclintstamp
13451337

13461338
tools/.doclintstamp: test/addons/.docbuildstamp
1347-
@echo "Running C++ linter on addon docs..."
1339+
$(info Running C++ linter on addon docs...)
13481340
@$(PYTHON) tools/cpplint.py $(CPPLINT_QUIET) --filter=$(ADDON_DOC_LINT_FLAGS) \
13491341
$(LINT_CPP_ADDON_DOC_FILES_GLOB)
13501342
@touch $@
13511343

13521344
cpplint: lint-cpp
1353-
@echo "Please use lint-cpp instead of cpplint"
1345+
$(warning Please use lint-cpp instead of cpplint)
13541346

13551347
.PHONY: lint-py-build
13561348
# python -m pip install flake8
13571349
# Try with '--system' is to overcome systems that blindly set '--user'
13581350
lint-py-build:
1359-
@echo "Pip installing flake8 linter on $(shell $(PYTHON) --version)..."
1351+
$(info Pip installing flake8 linter on $(shell $(PYTHON) --version)...)
13601352
$(PYTHON) -m pip install --upgrade -t tools/pip/site-packages flake8 || \
13611353
$(PYTHON) -m pip install --upgrade --system -t tools/pip/site-packages flake8
13621354

@@ -1368,8 +1360,8 @@ lint-py:
13681360
PYTHONPATH=tools/pip $(PYTHON) -m flake8 --count --show-source --statistics .
13691361
else
13701362
lint-py:
1371-
@echo "Python linting with flake8 is not avalible"
1372-
@echo "Run 'make lint-py-build'"
1363+
$(warning Python linting with flake8 is not avalible)
1364+
$(warning Run 'make lint-py-build')
13731365
endif
13741366

13751367
.PHONY: lint
@@ -1395,12 +1387,9 @@ lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs
13951387
exit 1 ; \
13961388
fi
13971389
else
1398-
lint:
1399-
@echo "Linting is not available through the source tarball."
1400-
@echo "Use the git repo instead:" \
1401-
"$ git clone https://github.com/nodejs/node.git"
1402-
1403-
lint-ci: lint
1390+
lint lint-ci:
1391+
$(info Linting is not available through the source tarball.)
1392+
$(info Use the git repo instead: $$ git clone https://github.com/nodejs/node.git)
14041393
endif
14051394

14061395
.PHONY: lint-clean
@@ -1420,6 +1409,5 @@ gen-openssl: ## Generate platform dependent openssl files (requires docker)
14201409
$(DOCKER_COMMAND) node-openssl-builder make -C deps/openssl/config
14211410
else
14221411
gen-openssl:
1423-
@echo "No docker command, cannot continue"
1424-
@exit 1
1412+
$(error No docker command, cannot continue)
14251413
endif

0 commit comments

Comments
 (0)