[PATCH 2/2] move parsing and check for default env into common makefile

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


The CONFIG_DEFAULT_ENVRIONMENT_PATH is used only while building common stuffs.
Hence Having parsing and sanity check for CONFIG_DEFAULT_ENVRIONMENT_PATH in the
main Makefile does not make a lot sense. Move these stuffs into to
common/Makefile to fix this. This also fixes the issue, that the barebox could
not deal with absolute path in CONFIG_DEFAULT_ENVRIONMENT_PATH.

Signed-off-by: Luotao Fu <l.fu at pengutronix.de>
---
 Makefile        |   24 ------------------------
 common/Makefile |   28 +++++++++++++++++++++++++---
 2 files changed, 25 insertions(+), 27 deletions(-)

diff --git a/Makefile b/Makefile
index ec7fb10..282e6c6 100644
--- a/Makefile
+++ b/Makefile
@@ -1288,27 +1288,3 @@ Makefile: ;
 # information in a variable se we can use it in if_changed and friends.
 .PHONY: $(PHONY)
 
-#
-# sanity checks for check default environemnt
-#
-ifdef CONFIG_DEFAULT_ENVIRONMENT
-
-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)" 2> /dev/null && /bin/pwd)
-$(if $(CONFIG_DEFAULT_ENVIRONMENT_PATH),, \
-	$(error default environment path $(saved-env_path) does not exist))
-
-endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
diff --git a/common/Makefile b/common/Makefile
index 0c075a9..a928f5c 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -19,12 +19,34 @@ obj-$(CONFIG_MODULES) += module.o
 extra-$(CONFIG_MODULES) += module.lds
 
 ifdef CONFIG_DEFAULT_ENVIRONMENT
+#
+# sanity checks for check default environemnt
+#
+
+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)" 2> /dev/null && /bin/pwd)
+$(if $(CONFIG_DEFAULT_ENVIRONMENT_PATH),, \
+	$(error default environment path $(saved-env_path) does not exist))
+
 $(obj)/startup.o: include/barebox_default_env.h
 $(obj)/env.o: include/barebox_default_env.h
 
-ENV_FILES := $(shell find $(srctree)/$(CONFIG_DEFAULT_ENVIRONMENT_PATH))
-endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
+ENV_FILES := $(shell find $(CONFIG_DEFAULT_ENVIRONMENT_PATH))
 
 include/barebox_default_env.h: $(ENV_FILES)
-	$(Q)scripts/bareboxenv -s $(srctree)/$(CONFIG_DEFAULT_ENVIRONMENT_PATH) barebox_default_env
+	$(Q)scripts/bareboxenv -s $(CONFIG_DEFAULT_ENVIRONMENT_PATH) barebox_default_env
 	$(Q)cat barebox_default_env | scripts/bin2c default_environment > $@
+endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
-- 
1.7.0




More information about the barebox mailing list