Skip to content

Commit c509485

Browse files
aduh95BethGriggs
authored andcommitted
build: use make functions instead of echo
PR-URL: #35707 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent b78294d commit c509485

File tree

1 file changed

+31
-43
lines changed

1 file changed

+31
-43
lines changed

Makefile

Lines changed: 31 additions & 43 deletions
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 \
@@ -671,7 +668,7 @@ test-v8: v8 ## Runs the V8 test suite on deps/v8.
671668
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) $(V8_TEST_OPTIONS) \
672669
mjsunit cctest debugger inspector message preparser \
673670
$(TAP_V8)
674-
@echo Testing hash seed
671+
$(info Testing hash seed)
675672
$(MAKE) test-hash-seed
676673

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

699695
apidoc_dirs = out/doc out/doc/api out/doc/api/assets
@@ -928,14 +924,13 @@ MACOSOUTDIR=out/macos
928924

929925
ifeq ($(SKIP_XZ), 1)
930926
check-xz:
931-
@echo "SKIP_XZ=1 supplied, skipping .tar.xz creation"
927+
$(info SKIP_XZ=1 supplied, skipping .tar.xz creation)
932928
else
933929
ifeq ($(HAS_XZ), 1)
934930
check-xz:
935931
else
936932
check-xz:
937-
@echo "No xz command, cannot continue"
938-
@exit 1
933+
$(error No xz command, cannot continue)
939934
endif
940935
endif
941936

@@ -1168,12 +1163,9 @@ ifeq ($(XZ), 1)
11681163
endif
11691164

11701165
.PHONY: bench-all
1171-
bench-all: bench-addons-build
1172-
@echo "Please use benchmark/run.js or benchmark/compare.js to run the benchmarks."
1173-
11741166
.PHONY: bench
1175-
bench: bench-addons-build
1176-
@echo "Please use benchmark/run.js or benchmark/compare.js to run the benchmarks."
1167+
bench bench-all: bench-addons-build
1168+
$(warning Please use benchmark/run.js or benchmark/compare.js to run the benchmarks.)
11771169

11781170
# Build required addons for benchmark before running it.
11791171
.PHONY: bench-addons-build
@@ -1197,7 +1189,7 @@ lint-md-clean:
11971189

11981190
.PHONY: lint-md-build
11991191
lint-md-build:
1200-
$(warning "Deprecated no-op target 'lint-md-build'")
1192+
$(warning Deprecated no-op target 'lint-md-build')
12011193

12021194
ifeq ("$(wildcard tools/.mdlintstamp)","")
12031195
LINT_MD_NEWER =
@@ -1212,7 +1204,7 @@ LINT_MD_FILES = $(shell $(FIND) $(LINT_MD_TARGETS) -type f \
12121204
run-lint-md = tools/lint-md.js -q -f --no-stdout $(LINT_MD_FILES)
12131205
# Lint all changed markdown files maintained by us
12141206
tools/.mdlintstamp: $(LINT_MD_FILES)
1215-
@echo "Running Markdown linter..."
1207+
$(info Running Markdown linter...)
12161208
@$(call available-node,$(run-lint-md))
12171209
@touch $@
12181210

@@ -1243,7 +1235,7 @@ lint-js:
12431235
fi
12441236

12451237
jslint: lint-js
1246-
@echo "Please use lint-js instead of jslint"
1238+
$(warning Please use lint-js instead of jslint)
12471239

12481240
run-lint-js-ci = tools/node_modules/eslint/bin/eslint.js \
12491241
--report-unused-disable-directives --ext=.js,.mjs,.md -f tap \
@@ -1252,11 +1244,11 @@ run-lint-js-ci = tools/node_modules/eslint/bin/eslint.js \
12521244
.PHONY: lint-js-ci
12531245
# On the CI the output is emitted in the TAP format.
12541246
lint-js-ci:
1255-
@echo "Running JS linter..."
1247+
$(info Running JS linter...)
12561248
@$(call available-node,$(run-lint-js-ci))
12571249

12581250
jslint-ci: lint-js-ci
1259-
@echo "Please use lint-js-ci instead of jslint-ci"
1251+
$(warning Please use lint-js-ci instead of jslint-ci)
12601252

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

13271319
ifeq ($(V),1)
@@ -1334,7 +1326,7 @@ endif
13341326
lint-cpp: tools/.cpplintstamp
13351327

13361328
tools/.cpplintstamp: $(LINT_CPP_FILES)
1337-
@echo "Running C++ linter..."
1329+
$(info Running C++ linter...)
13381330
@$(PYTHON) tools/cpplint.py $(CPPLINT_QUIET) $?
13391331
@$(PYTHON) tools/checkimports.py $?
13401332
@touch $@
@@ -1343,19 +1335,19 @@ tools/.cpplintstamp: $(LINT_CPP_FILES)
13431335
lint-addon-docs: tools/.doclintstamp
13441336

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

13511343
cpplint: lint-cpp
1352-
@echo "Please use lint-cpp instead of cpplint"
1344+
$(warning Please use lint-cpp instead of cpplint)
13531345

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

@@ -1367,8 +1359,8 @@ lint-py:
13671359
PYTHONPATH=tools/pip $(PYTHON) -m flake8 --count --show-source --statistics .
13681360
else
13691361
lint-py:
1370-
@echo "Python linting with flake8 is not avalible"
1371-
@echo "Run 'make lint-py-build'"
1362+
$(warning Python linting with flake8 is not avalible)
1363+
$(warning Run 'make lint-py-build')
13721364
endif
13731365

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

14051394
.PHONY: lint-clean
@@ -1419,6 +1408,5 @@ gen-openssl: ## Generate platform dependent openssl files (requires docker)
14191408
$(DOCKER_COMMAND) node-openssl-builder make -C deps/openssl/config
14201409
else
14211410
gen-openssl:
1422-
@echo "No docker command, cannot continue"
1423-
@exit 1
1411+
$(error No docker command, cannot continue)
14241412
endif

0 commit comments

Comments
 (0)