Skip to content

Commit

Permalink
build: only try to find node when it's needed by the target
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
joyeecheung authored and MylesBorins committed Dec 26, 2018
1 parent 44a1993 commit 042749f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,16 @@ ifeq ($(OSTYPE),aix)
DOCBUILDSTAMP_PREREQS := $(DOCBUILDSTAMP_PREREQS) out/$(BUILDTYPE)/node.exp
endif

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

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

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

.PHONY: doc-only
doc-only: tools/doc/node_modules \
Expand Down

0 comments on commit 042749f

Please sign in to comment.