From a2c7085dd4a8e60d1a47572aca8bb6fcb7a32f88 Mon Sep 17 00:00:00 2001 From: Yang Guo Date: Mon, 8 Jan 2018 16:31:07 +0100 Subject: build: fix Makefile wrt finding node executable Not all shells set PWD, so use CURDIR instead. `which node` may return the empty string, so guard against that too. Consider: if [ -x `which velociraptor` ] && [ -e `which velociprator` ];\ then echo "run"; else echo "keep calm"; fi; PR-URL: https://github.com/nodejs/node/pull/18040 Reviewed-By: Evan Lucas Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Joyee Cheung --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 213284aa70..3763c78e91 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ COVTESTS ?= test-cov GTEST_FILTER ?= "*" GNUMAKEFLAGS += --no-print-directory GCOV ?= gcov +PWD = $(CURDIR) ifdef JOBS PARALLEL_ARGS = -j $(JOBS) @@ -640,7 +641,7 @@ out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets available-node = \ if [ -x $(PWD)/$(NODE) ] && [ -e $(PWD)/$(NODE) ]; then \ $(PWD)/$(NODE) $(1); \ - elif [ -x `which node` ] && [ -e `which node` ]; then \ + elif [ -x `which node` ] && [ -e `which node` ] && [ `which node` ]; then \ `which node` $(1); \ else \ echo "No available node, cannot run \"node $(1)\""; \ -- cgit v1.2.3