[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/5] build: add new make pattern for making file from file.src



Add a new make pattern for creating <file> from <file>.src at build
time. Define the recipe as a macro in order to avoid replicating it
for cases where it needs to handle subdirectories (creating
<dir>/<file> from <dir>/<file>.src).

This can be used instead of the current approach to perform the similar
step for file.in during ./configure by renaming the source file to
file.src.

This will avoid having to run ./configure just because of modifying a
file depending on a variable set by configure.

Prepare to have multiple files as source for the replacement patterns.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 Config.mk | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Config.mk b/Config.mk
index e1556dfbfa..0ea1640371 100644
--- a/Config.mk
+++ b/Config.mk
@@ -159,6 +159,20 @@ define move-if-changed
        if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
 endef
 
+PATH_FILES := Paths
+INC_FILES := $(foreach f, $(PATH_FILES), $(XEN_ROOT)/config/$(f).mk)
+
+include $(INC_FILES)
+
+BUILD_MAKE_VARS := $(foreach f, $(PATH_FILES), $(shell awk '$$2 == ":=" { 
print $$1; }' $(XEN_ROOT)/config/$(f).mk.in))
+
+define apply-build-vars
+       sed $(foreach v, $(BUILD_MAKE_VARS), -e 's#@$(v)@#$($(v))#g') <$< >$@
+endef
+
+%:: %.src
+       $(apply-build-vars)
+
 CFLAGS += -fno-strict-aliasing
 
 CFLAGS += -std=gnu99
-- 
2.51.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.