[PATCH 1/2] Makefile: fix detection of absolute environment path

Luotao Fu l.fu at pengutronix.de
Fri Apr 16 03:08:49 EDT 2010


From: Marc Kleine-Budde <mkl at pengutronix.de>

string-type config symbols als wrapped in quotes ("), remove them before
trying to detect an absolute path.

Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
---
 Makefile |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index c92c5dd..ec7fb10 100644
--- a/Makefile
+++ b/Makefile
@@ -1293,12 +1293,21 @@ Makefile: ;
 #
 ifdef CONFIG_DEFAULT_ENVIRONMENT
 
-ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
+quote :="#"
+
+define remove_quotes
+$(strip $(subst $(quote),,$(1)))
+endef
+
+CONFIG_DEFAULT_ENVIRONMENT_PATH := $(call remove_quotes, $(CONFIG_DEFAULT_ENVIRONMENT_PATH))
+
+ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),)
 $(error default environment path empty))
 endif
 
 saved-env_path := $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
-CONFIG_DEFAULT_ENVIRONMENT_PATH := $(shell cd $(if $(filter /%,$(CONFIG_DEFAULT_ENVIRONMENT_PATH)),,$(srctree)/)$(CONFIG_DEFAULT_ENVIRONMENT_PATH) && /bin/pwd)
+CONFIG_DEFAULT_ENVIRONMENT_PATH := \
+	$(shell cd "$(if $(filter /%,$(CONFIG_DEFAULT_ENVIRONMENT_PATH)),,$(srctree)/)$(CONFIG_DEFAULT_ENVIRONMENT_PATH)" 2> /dev/null && /bin/pwd)
 $(if $(CONFIG_DEFAULT_ENVIRONMENT_PATH),, \
 	$(error default environment path $(saved-env_path) does not exist))
 
-- 
1.7.0




More information about the barebox mailing list