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

[xen staging] build: add make macro for making file from file.in



commit 82b9cc04a7c77cf7a56b66eca322cce97840e456
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Fri Nov 21 14:23:29 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Nov 21 15:51:49 2025 +0000

    build: add make macro for making file from file.in
    
    Add a new make macro for creating <file> from <file>.in at build
    time. To be used like this:
    
    $(foreach file,$(IN_TARGETS),$(eval $(call apply-build-vars,$(file))))
    
    This can be used instead of the current approach to perform the similar
    step for file.in during ./configure.
    
    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>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 Config.mk | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Config.mk b/Config.mk
index e1556dfbfa..dbb8bb4de7 100644
--- a/Config.mk
+++ b/Config.mk
@@ -159,6 +159,19 @@ define move-if-changed
        if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
 endef
 
+PATH_FILES := Paths.mk
+INC_FILES = $(foreach f, $(PATH_FILES), $(XEN_ROOT)/config/$(f))
+
+-include $(INC_FILES)
+
+BUILD_MAKE_VARS = $(foreach f, $(PATH_FILES), $(shell awk '$$2 == ":=" { print 
$$1; }' $(XEN_ROOT)/config/$(f).in))
+
+# Replace @xxx@ markers in $(1).in with $(xxx) variable contents, write to $(1)
+define apply-build-vars
+ $(1): $(1).in $$(INC_FILES)
+       sed $$(foreach v, $$(BUILD_MAKE_VARS), -e 's#@$$(v)@#$$($$(v))#g') <$$< 
>$$@
+endef
+
 CFLAGS += -fno-strict-aliasing
 
 CFLAGS += -std=gnu99
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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