Add HW.Config for configuration constants

Change-Id: Id60c61fc53c6e153dcb3cf9f5c55668e38072817
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/20556
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
diff --git a/common/Makefile.inc b/common/Makefile.inc
index a08a7df..8759664 100644
--- a/common/Makefile.inc
+++ b/common/Makefile.inc
@@ -11,3 +11,11 @@
 hw-y += hw-time-timer.ads
 
 hw-$(CONFIG_HWBASE_POSIX_FILE) += hw-file.ads
+
+hw-config-ads := $(subst //,/,$(call src-to-obj,,$(dir)/hw-config).ads)
+$(hw-config-ads): $(dir)/hw-config.ads.template $(cnf)
+	printf "    GENERATE   $(patsubst /%,%,$(subst $(obj)/,,$@))\n"
+	sed \
+	    -e's/<<DYNAMIC_MMIO>>/$(if $(filter y,$(CONFIG_HWBASE_DYNAMIC_MMIO)),True,False)/' \
+	    $< >$@
+hw-gen-y += $(hw-config-ads)