From 8baeddcc1717e920ea051cb6481627d7e7d2eca3 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Tue, 6 Nov 2018 10:55:09 +0800 Subject: [PATCH 1/2] 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. --- Makefile | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index aa8d75242c00f5..57d48a74a5c74f 100644 --- a/Makefile +++ b/Makefile @@ -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, \ @@ -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 \ From 18c011eb5bc217dbd0dd1976c77e0cffded9e44c Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Tue, 6 Nov 2018 20:04:14 +0800 Subject: [PATCH 2/2] fixup! build: only try to run node when it's needed by the target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 57d48a74a5c74f..c58e6ad1dc13d7 100644 --- a/Makefile +++ b/Makefile @@ -610,7 +610,7 @@ apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_as tools/doc/node_modules: tools/doc/package.json @if [ "$(shell $(node_use_openssl))" != "true" ]; then \ - @echo "Skipping tools/doc/node_modules (no crypto)"; \ + echo "Skipping tools/doc/node_modules (no crypto)"; \ else \ cd tools/doc && $(call available-node,$(run-npm-ci)) \ fi