From fbd4074b377fa4714ede847bc1475a7c4dd364c7 Mon Sep 17 00:00:00 2001 From: Yang Guo Date: Mon, 8 Jan 2018 16:31:07 +0100 Subject: [PATCH] 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; --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b58a32d2c28be0..1078f01c29a27a 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) @@ -609,7 +610,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)\""; \