From 077073d2163d40238a5a75181bce34e49a894750 Mon Sep 17 00:00:00 2001
From: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
Date: Tue, 30 Sep 2014 00:34:57 +0200
Subject: [PATCH] config target: introduce dynamic config target

---
 Makefile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index cf64824..7d25a69 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,10 @@ CONFIG_FILE=$(CURDIR)/config/Makefile.conf
 include $(CONFIG_FILE_DEFAULTS)
 include $(CONFIG_FILE)
 
+#list of offically supported config options; they should have a default value in CONFIG_FILE_DEFAULTS
+CONFIGURABLE=PRIMARY_ARCH SECONDARY_ARCH WORKSPACE ISO_BASE_URL ISO_RELEASE ISO_VERSION ISO_FLAVOR \
+	IMAGE_GIT_URL IMAGE_GIT_BRANCH
+
 ifndef ARCH
   ARCH=$(PRIMARY_ARCH)
 endif
@@ -260,10 +264,8 @@ image : image_content
 
 config $(CONFIG_FILE):
 	@echo "Generating configuration $(CONFIG_FILE)"
-	echo -n "" > $(CONFIG_FILE)
-	echo "PRIMARY_ARCH=$(PRIMARY_ARCH)" >> "$(CONFIG_FILE)"
-	echo "SECONDARY_ARCH=$(SECONDARY_ARCH)" >> "$(CONFIG_FILE)"
-	echo "WORKSPACE=$(WORKSPACE)" >> "$(CONFIG_FILE)"
+	echo "#see $(CONFIG_FILE_DEFAULTS) for default values." > "$(CONFIG_FILE)"
+	echo -e -n "$(foreach option,$(CONFIGURABLE),$(option)=$($(option))\n)" | tr -d "[:blank:]" >> "$(CONFIG_FILE)"
 
 config_clean:
 	$(RM) $(CONFIG_FILE)
-- 
GitLab