Skip to content

Commit a8008d1

Browse files
joyeecheungBridgeAR
authored andcommitted
build: only try to find node when it's needed by the target
Right now `node -p process.versions.openssl` always gets run in the Makefile even when it's not needed by the target (e.g. `make clean`, `make test-only`). This patch makes it a run time call instead of part of the global expansion. PR-URL: #24115 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
1 parent a9053c3 commit a8008d1

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Makefile

+14-14
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,16 @@ ifeq ($(OSTYPE),aix)
332332
DOCBUILDSTAMP_PREREQS := $(DOCBUILDSTAMP_PREREQS) out/$(BUILDTYPE)/node.exp
333333
endif
334334

335-
node_use_openssl = $(shell $(call available-node,"-p" \
336-
"process.versions.openssl != undefined"))
335+
node_use_openssl = $(call available-node,"-p" \
336+
"process.versions.openssl != undefined")
337337
test/addons/.docbuildstamp: $(DOCBUILDSTAMP_PREREQS) tools/doc/node_modules
338-
ifeq ($(node_use_openssl),true)
339-
$(RM) -r test/addons/??_*/
340-
[ -x $(NODE) ] && $(NODE) $< || node $<
341-
touch $@
342-
else
343-
@echo "Skipping .docbuildstamp (no crypto)"
344-
endif
338+
@if [ "$(shell $(node_use_openssl))" != "true" ]; then \
339+
echo "Skipping .docbuildstamp (no crypto)"; \
340+
else \
341+
$(RM) -r test/addons/??_*/; \
342+
[ -x $(NODE) ] && $(NODE) $< || node $< ; \
343+
touch $@; \
344+
fi
345345

346346
ADDONS_BINDING_GYPS := \
347347
$(filter-out test/addons/??_*/binding.gyp, \
@@ -609,11 +609,11 @@ apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json))
609609
apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
610610

611611
tools/doc/node_modules: tools/doc/package.json
612-
ifeq ($(node_use_openssl),true)
613-
cd tools/doc && $(call available-node,$(run-npm-ci))
614-
else
615-
@echo "Skipping tools/doc/node_modules (no crypto)"
616-
endif
612+
@if [ "$(shell $(node_use_openssl))" != "true" ]; then \
613+
echo "Skipping tools/doc/node_modules (no crypto)"; \
614+
else \
615+
cd tools/doc && $(call available-node,$(run-npm-ci)) \
616+
fi
617617

618618
.PHONY: doc-only
619619
doc-only: tools/doc/node_modules \

0 commit comments

Comments
 (0)