Skip to contentSkip to conversation

configure: reduce number of files created

PATCH In review Juergen Gross 3 participants 20 messages Nov 21, 2025 – Dec 11, 2025

lore
Share & tools
lore
#0 lore raw

v3 cover configure: reduce number of files created

Instead of creating lots of files during configure, create those files (where possible) rather at build time. This reduces the need to run configure when e.g. changing a man page containing a path defined by the configure run.

Changes in V2:
- dropped patch 1 as already applied
- no longer rename files to *.src
- don't use pattern rule

Changes in V3:
- addressed comments by Jan and Andrew

Juergen Gross (4):
build: add make macro for making file from file.in
docs: replace @xxx@ markers at build time
config: remove unused paths from config/Paths.mk.in
tools: replace @xxx@ markers at build time

 .gitignore                     |  1 +
 Config.mk                      | 13 +++++++++++++
 config/Paths.mk.in             |  6 ------
 config/Tools-paths.mk.in       | 10 ++++++++++
 docs/Makefile                  | 11 ++++++++++-
 docs/configure                 |  7 +------
 docs/configure.ac              |  9 +--------
 tools/Rules.mk                 |  4 ++++
 tools/configure                | 21 ++-------------------
 tools/configure.ac             | 19 +------------------
 tools/hotplug/FreeBSD/Makefile | 13 +++++++++++--
 tools/hotplug/Linux/Makefile   | 21 +++++++++++++++++++--
 tools/hotplug/NetBSD/Makefile  | 13 +++++++++++--
 tools/hotplug/common/Makefile  | 10 +++++++++-
 tools/ocaml/libs/xs/Makefile   |  9 +++++++++
 tools/ocaml/xenstored/Makefile | 10 +++++++++-
 16 files changed, 111 insertions(+), 66 deletions(-)
 create mode 100644 config/Tools-paths.mk.in
Signature · 1 line
2.51.0
#1 lore raw

PATCH v3 1/4 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.

---
V2:
- don't use pattern rule, but create explicit dependency in macro, don't require to rename source files (Jan Beulich, Andrew Cooper)
V3:
- prepare for $(PATH_FILES) to be extended by other Makefile
- let generated file depend on $(INC_FILES)

---
 Config.mk | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Config.mk +13 -0
index e1556dfbfa..39e8007b9c 100644
@@ -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
+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))
+
+# 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
Signature · 1 line
2.51.0
#2 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 30 lines · Juergen Gross

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.

---
V2:
- don't use pattern rule, but create explicit dependency in macro, don't require to rename source files (Jan Beulich, Andrew Cooper)
V3:
- prepare for $(PATH_FILES) to be extended by other Makefile
- let generated file depend on $(INC_FILES)

---
 Config.mk | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Config.mk +0 -0
index e1556dfbfa..39e8007b9c 100644

Config.mk define move-if-changed · line 167

Quoted 9 lines
Config.mk +6 -0
@@ -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
+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))

Everything else in the series is looking fine now.  But why is PATH_FILES dropping the .mk extension from the file?

It looks weird for both INC_FILES and BUILD_MAKE_VARS to have to re-insert it.

~Andrew

#3 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 44 lines · Andrew Cooper
Quoted 30 lines · Juergen Gross

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.

---
V2:
- don't use pattern rule, but create explicit dependency in macro, don't require to rename source files (Jan Beulich, Andrew Cooper)
V3:
- prepare for $(PATH_FILES) to be extended by other Makefile
- let generated file depend on $(INC_FILES)

---
  Config.mk | 13 +++++++++++++
  1 file changed, 13 insertions(+)
Config.mk +0 -0
index e1556dfbfa..39e8007b9c 100644

Config.mk define move-if-changed · line 167

Quoted 9 lines
Config.mk +6 -0
@@ -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
+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))

Everything else in the series is looking fine now.  But why is PATH_FILES dropping the .mk extension from the file?

Quoted 2 lines

It looks weird for both INC_FILES and BUILD_MAKE_VARS to have to re-insert it.

Hmm, right.

Let me change that.

Juergen

#4 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 45 lines · Jürgen Groß
Quoted 44 lines · Andrew Cooper
Quoted 38 lines · Juergen Gross

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.

---
V2:
- don't use pattern rule, but create explicit dependency in macro, don't require to rename source files (Jan Beulich, Andrew Cooper) V3:
- prepare for $(PATH_FILES) to be extended by other Makefile
- let generated file depend on $(INC_FILES)
---
  Config.mk | 13 +++++++++++++

  1 file changed, 13 insertions(+)
Config.mk +0 -0
index e1556dfbfa..39e8007b9c 100644
@@ -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

Config.mk +5 -0
+INC_FILES = $(foreach f, $(PATH_FILES), $(XEN_ROOT)/config/$(f).mk)
+
+include $(INC_FILES)
+
+BUILD_MAKE_VARS = $(foreach f, $(PATH_FILES), $(shell awk '$$2 ==
Quoted 1 line

":=" { print $$1; }' $(XEN_ROOT)/config/$(f).mk.in))

Everything else in the series is looking fine now.  But why is PATH_FILES dropping the .mk extension from the file?

Quoted 6 lines
Quoted 2 lines

It looks weird for both INC_FILES and BUILD_MAKE_VARS to have to re-insert it.

Hmm, right.

Let me change that.

If it's only that, I could fix up on commit to save another posting.

Whole series, Reviewed-by: Andrew Cooper <[email protected]>

#5 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 49 lines · Andrew Cooper
Quoted 48 lines · Jürgen Groß
Quoted 46 lines · Andrew Cooper
Quoted 30 lines · Juergen Gross

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.

---
V2:
- don't use pattern rule, but create explicit dependency in macro, don't require to rename source files (Jan Beulich, Andrew Cooper)
V3:
- prepare for $(PATH_FILES) to be extended by other Makefile
- let generated file depend on $(INC_FILES)

---
   Config.mk | 13 +++++++++++++
   1 file changed, 13 insertions(+)
Config.mk +0 -0
index e1556dfbfa..39e8007b9c 100644

Config.mk define move-if-changed · line 167

Quoted 9 lines
Config.mk +5 -0
@@ -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
+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))

Everything else in the series is looking fine now.  But why is PATH_FILES dropping the .mk extension from the file?

It looks weird for both INC_FILES and BUILD_MAKE_VARS to have to re-insert it.

Quoted 7 lines
Quoted 3 lines

Hmm, right.

Let me change that.

If it's only that, I could fix up on commit to save another posting.

Whole series, Reviewed-by: Andrew Cooper <[email protected]>

You need to fix up patch 4, too (in tools/Rules.mk).

Thanks,

Juergen

#6 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

In reply to Juergen Gross

Config.mk define move-if-changed · line 167

Quoted 12 lines · Juergen Gross
Config.mk +6 -0
@@ -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
+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))

Feels like my prior comments weren't really addressed. I continue to think that none of the above is part of what the subject says.

Config.mk define move-if-changed · line 171

Quoted 3 lines
Config.mk +3 -0
+# Replace @xxx@ markers in $(1).in with $(xxx) variable contents, write to $(1)
+define apply-build-vars
+ $(1): $(1).in $$(INC_FILES)

I further understood your reply to my v2 comment the way that you would drop the slightly odd leading blank from here.

Jan

Quoted 6 lines
Config.mk +3 -0
+	sed $$(foreach v, $$(BUILD_MAKE_VARS), -e 's#@$$(v)@#$$($$(v))#g') <$$< >$$@
+endef
+
 CFLAGS += -fno-strict-aliasing
 
 CFLAGS += -std=gnu99
#7 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 7 lines · Jan Beulich
Quoted 6 lines · Juergen Gross
Config.mk +0 -0
@@ -159,6 +159,19 @@ define move-if-changed
  	if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
  endef
 
Quoted 9 lines

Config.mk define move-if-changed · line 167

Quoted 6 lines
Config.mk +6 -0
+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))

Feels like my prior comments weren't really addressed. I continue to think that none of the above is part of what the subject says.

I really don't understand your concern here.

For replacing the @markers@ make needs to know what should be replaced. So it needs to scan the files containing the markers and gather them. This is what is done above.

In the final macro below the replacements are done then. How would you handle that?

Quoted 7 lines

Config.mk define move-if-changed · line 171

Quoted 4 lines
Config.mk +3 -0
+# Replace @xxx@ markers in $(1).in with $(xxx) variable contents, write to $(1)
+define apply-build-vars
+ $(1): $(1).in $$(INC_FILES)

I further understood your reply to my v2 comment the way that you would drop the slightly odd leading blank from here.

Oh, with no further response I didn't see a reason to act immediately.

Juergen

#8 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 18 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Juergen Gross
Config.mk +0 -0
@@ -159,6 +159,19 @@ define move-if-changed
  	if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
  endef
 
Quoted 9 lines

Config.mk define move-if-changed · line 167

Quoted 6 lines
Config.mk +6 -0
+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))

Feels like my prior comments weren't really addressed. I continue to think that none of the above is part of what the subject says.

Quoted 8 lines

I really don't understand your concern here.

For replacing the @markers@ make needs to know what should be replaced. So it needs to scan the files containing the markers and gather them. This is what is done above.

In the final macro below the replacements are done then. How would you handle that?

By passing (another) argument to the macro, for example. As indicated earlier, different sub-trees may have different places where these definitions live, and they would want to be able to pass that in (ideally without needing to put this in a common part of the tree).

Jan

#9 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 25 lines · Jan Beulich
Quoted 24 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Juergen Gross
Config.mk +0 -0
@@ -159,6 +159,19 @@ define move-if-changed
   	if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
   endef
 
Quoted 9 lines

Config.mk define move-if-changed · line 167

Quoted 6 lines
Config.mk +6 -0
+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))

Feels like my prior comments weren't really addressed. I continue to think that none of the above is part of what the subject says.

I really don't understand your concern here.

For replacing the @markers@ make needs to know what should be replaced. So it needs to scan the files containing the markers and gather them. This is what is done above.

Quoted 7 lines
Quoted 2 lines

In the final macro below the replacements are done then. How would you handle that?

By passing (another) argument to the macro, for example. As indicated earlier, different sub-trees may have different places where these definitions live, and they would want to be able to pass that in (ideally without needing to put this in a common part of the tree).

I don't get what you want to pass in additionally.

I've already changed the macro and the Makefiles to be able to add another marker file to the PATH_FILES variable. What else do you need?

See patch 4 in tools/Rules.mk adding the additional reference to Tools-paths.mk by doing:

PATH_FILES += Tools-paths.mk

Juergen

#10 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 34 lines · Juergen Gross
Quoted 25 lines · Jan Beulich
Quoted 24 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Juergen Gross
Config.mk +0 -0
@@ -159,6 +159,19 @@ define move-if-changed
   	if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
   endef
 
Quoted 9 lines

Config.mk define move-if-changed · line 167

Quoted 6 lines
Config.mk +6 -0
+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))

Feels like my prior comments weren't really addressed. I continue to think that none of the above is part of what the subject says.

I really don't understand your concern here.

For replacing the @markers@ make needs to know what should be replaced. So it needs to scan the files containing the markers and gather them. This is what is done above.

Quoted 7 lines
Quoted 2 lines

In the final macro below the replacements are done then. How would you handle that?

By passing (another) argument to the macro, for example. As indicated earlier, different sub-trees may have different places where these definitions live, and they would want to be able to pass that in (ideally without needing to put this in a common part of the tree).

Quoted 4 lines

I don't get what you want to pass in additionally.

I've already changed the macro and the Makefiles to be able to add another marker file to the PATH_FILES variable. What else do you need?

Well, that's simply an odd way of passing a parameter. Plus, the extra file won't affect INC_FILES, or more precisely its use in the include directive in patch 1: At least aiui, $(INC_FILES) is expanded at the point when the directive is processed. Hence why you need to open-code another include there.

Jan

Quoted 7 lines

See patch 4 in tools/Rules.mk adding the additional reference to Tools-paths.mk by doing:

PATH_FILES += Tools-paths.mk

Juergen

#11 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 35 lines · Jan Beulich
Quoted 34 lines · Juergen Gross
Quoted 32 lines · Jan Beulich
Quoted 18 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Juergen Gross
Config.mk +0 -0
@@ -159,6 +159,19 @@ define move-if-changed
    	if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
    endef
 
Quoted 9 lines

Config.mk define move-if-changed · line 167

Quoted 6 lines
Config.mk +6 -0
+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))

Feels like my prior comments weren't really addressed. I continue to think that none of the above is part of what the subject says.

Quoted 8 lines

I really don't understand your concern here.

For replacing the @markers@ make needs to know what should be replaced. So it needs to scan the files containing the markers and gather them. This is what is done above.

In the final macro below the replacements are done then. How would you handle that?

By passing (another) argument to the macro, for example. As indicated earlier, different sub-trees may have different places where these definitions live, and they would want to be able to pass that in (ideally without needing to put this in a common part of the tree).

Quoted 6 lines
Quoted 4 lines

I don't get what you want to pass in additionally.

I've already changed the macro and the Makefiles to be able to add another marker file to the PATH_FILES variable. What else do you need?

Well, that's simply an odd way of passing a parameter. Plus, the extra file

We do that all the times, e.g. by "OBJ-y += ..."

Quoted 4 lines

won't affect INC_FILES, or more precisely its use in the include directive in patch 1: At least aiui, $(INC_FILES) is expanded at the point when the directive is processed. Hence why you need to open-code another include there.

The INC_FILES variable is mostly needed for specifying the dependence of the generated files on the files mentioned in PATH_FILES.

It might be better to just have "-include $(XEN_ROOT/config/Paths.mk" in Config.mk, matching the setting of PATH_FILES there.

Juergen

#12 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 36 lines · Jürgen Groß
Quoted 35 lines · Jan Beulich
Quoted 34 lines · Juergen Gross
Quoted 32 lines · Jan Beulich
Quoted 18 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Juergen Gross
Config.mk +0 -0
@@ -159,6 +159,19 @@ define move-if-changed
    	if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
    endef
 
Quoted 9 lines

Config.mk define move-if-changed · line 167

Quoted 6 lines
Config.mk +6 -0
+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))

Feels like my prior comments weren't really addressed. I continue to think that none of the above is part of what the subject says.

Quoted 8 lines

I really don't understand your concern here.

For replacing the @markers@ make needs to know what should be replaced. So it needs to scan the files containing the markers and gather them. This is what is done above.

In the final macro below the replacements are done then. How would you handle that?

By passing (another) argument to the macro, for example. As indicated earlier, different sub-trees may have different places where these definitions live, and they would want to be able to pass that in (ideally without needing to put this in a common part of the tree).

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I don't get what you want to pass in additionally.

I've already changed the macro and the Makefiles to be able to add another marker file to the PATH_FILES variable. What else do you need?

Well, that's simply an odd way of passing a parameter. Plus, the extra file

We do that all the times, e.g. by "OBJ-y += ..."

That's sufficiently different though: Accumulating the set of objects to produce is kind of naturally done that way.

Quoted 10 lines
Quoted 4 lines

won't affect INC_FILES, or more precisely its use in the include directive in patch 1: At least aiui, $(INC_FILES) is expanded at the point when the directive is processed. Hence why you need to open-code another include there.

The INC_FILES variable is mostly needed for specifying the dependence of the generated files on the files mentioned in PATH_FILES.

It might be better to just have "-include $(XEN_ROOT/config/Paths.mk" in Config.mk, matching the setting of PATH_FILES there.

Looking at this the 3rd or 4th time now, I still don't quite get why the include is needed in the first place. You don't mean to use (right here) any of the settings the file produces, do you? Really, as also mentioned by Andrew, you really can't, because in a pure hypervisor build the file wouldn't have been made, as no configure would have run.

If I'm not mistaken, you really need those values only at the time you execute the rule. And I'm worried of these definitions to collide with something else. Hence one desire would be to limit the scope of these variables to just the new rule. Maybe something like

# Replace @xxx@ markers in $(1).in with $(xxx) variable contents, write to $(1) define apply-build-vars
$(1): $$(shell grep -h := $$(wildcard $$(INC_FILES)) /dev/null) $(1): $(1).in $$(INC_FILES)

	sed $$(foreach v, $$(BUILD_MAKE_VARS), -e 's#@$$(v)@#$$($$(v))#g') <$$< >$$@

endef

could work? (This likely depends on INC_FILES to only list files which are configure generated, i.e. wouldn't be updated by a make rule.)

Jan

#13 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 75 lines · Jan Beulich
Quoted 36 lines · Jürgen Groß
Quoted 35 lines · Jan Beulich
Quoted 34 lines · Juergen Gross
Quoted 32 lines · Jan Beulich
Quoted 18 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Juergen Gross
Config.mk +0 -0
@@ -159,6 +159,19 @@ define move-if-changed
     	if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
     endef
 
Quoted 9 lines

Config.mk define move-if-changed · line 167

Quoted 6 lines
Config.mk +6 -0
+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))

Feels like my prior comments weren't really addressed. I continue to think that none of the above is part of what the subject says.

Quoted 8 lines

I really don't understand your concern here.

For replacing the @markers@ make needs to know what should be replaced. So it needs to scan the files containing the markers and gather them. This is what is done above.

In the final macro below the replacements are done then. How would you handle that?

By passing (another) argument to the macro, for example. As indicated earlier, different sub-trees may have different places where these definitions live, and they would want to be able to pass that in (ideally without needing to put this in a common part of the tree).

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I don't get what you want to pass in additionally.

I've already changed the macro and the Makefiles to be able to add another marker file to the PATH_FILES variable. What else do you need?

Well, that's simply an odd way of passing a parameter. Plus, the extra file

We do that all the times, e.g. by "OBJ-y += ..."

That's sufficiently different though: Accumulating the set of objects to produce is kind of naturally done that way.

Quoted 10 lines
Quoted 4 lines

won't affect INC_FILES, or more precisely its use in the include directive in patch 1: At least aiui, $(INC_FILES) is expanded at the point when the directive is processed. Hence why you need to open-code another include there.

The INC_FILES variable is mostly needed for specifying the dependence of the generated files on the files mentioned in PATH_FILES.

It might be better to just have "-include $(XEN_ROOT/config/Paths.mk" in Config.mk, matching the setting of PATH_FILES there.

Looking at this the 3rd or 4th time now, I still don't quite get why the include is needed in the first place. You don't mean to use (right here) any of the settings the file produces, do you? Really, as also mentioned by Andrew, you really can't, because in a pure hypervisor build the file wouldn't have been made, as no configure would have run.

If I'm not mistaken, you really need those values only at the time you execute the rule. And I'm worried of these definitions to collide with something else. Hence one desire would be to limit the scope of these variables to just the new rule. Maybe something like

# Replace @xxx@ markers in $(1).in with $(xxx) variable contents, write to $(1) define apply-build-vars
$(1): $$(shell grep -h := $$(wildcard $$(INC_FILES)) /dev/null) $(1): $(1).in $$(INC_FILES)

Quoted 5 lines
	sed $$(foreach v, $$(BUILD_MAKE_VARS), -e 's#@$$(v)@#$$($$(v))#g') <$$< >$$@

endef

could work? (This likely depends on INC_FILES to only list files which are configure generated, i.e. wouldn't be updated by a make rule.)

And who is setting BUILD_MAKE_VARS? You didn't think the snippet doing that should be there.

And TBH: any setting from Paths.mk colliding with something else would _really_ be worrying.

Juergen

#14 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 79 lines · Jürgen Groß
Quoted 78 lines · Jan Beulich
Quoted 36 lines · Jürgen Groß
Quoted 35 lines · Jan Beulich
Quoted 34 lines · Juergen Gross
Quoted 32 lines · Jan Beulich
Quoted 18 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Juergen Gross
Config.mk +0 -0
@@ -159,6 +159,19 @@ define move-if-changed
     	if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
     endef
 
Quoted 9 lines

Config.mk define move-if-changed · line 167

Quoted 6 lines
Config.mk +6 -0
+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))

Feels like my prior comments weren't really addressed. I continue to think that none of the above is part of what the subject says.

Quoted 8 lines

I really don't understand your concern here.

For replacing the @markers@ make needs to know what should be replaced. So it needs to scan the files containing the markers and gather them. This is what is done above.

In the final macro below the replacements are done then. How would you handle that?

By passing (another) argument to the macro, for example. As indicated earlier, different sub-trees may have different places where these definitions live, and they would want to be able to pass that in (ideally without needing to put this in a common part of the tree).

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I don't get what you want to pass in additionally.

I've already changed the macro and the Makefiles to be able to add another marker file to the PATH_FILES variable. What else do you need?

Well, that's simply an odd way of passing a parameter. Plus, the extra file

We do that all the times, e.g. by "OBJ-y += ..."

That's sufficiently different though: Accumulating the set of objects to produce is kind of naturally done that way.

Quoted 10 lines
Quoted 4 lines

won't affect INC_FILES, or more precisely its use in the include directive in patch 1: At least aiui, $(INC_FILES) is expanded at the point when the directive is processed. Hence why you need to open-code another include there.

The INC_FILES variable is mostly needed for specifying the dependence of the generated files on the files mentioned in PATH_FILES.

It might be better to just have "-include $(XEN_ROOT/config/Paths.mk" in Config.mk, matching the setting of PATH_FILES there.

Looking at this the 3rd or 4th time now, I still don't quite get why the include is needed in the first place. You don't mean to use (right here) any of the settings the file produces, do you? Really, as also mentioned by Andrew, you really can't, because in a pure hypervisor build the file wouldn't have been made, as no configure would have run.

If I'm not mistaken, you really need those values only at the time you execute the rule. And I'm worried of these definitions to collide with something else. Hence one desire would be to limit the scope of these variables to just the new rule. Maybe something like

# Replace @xxx@ markers in $(1).in with $(xxx) variable contents, write to $(1) define apply-build-vars
$(1): $$(shell grep -h := $$(wildcard $$(INC_FILES)) /dev/null) $(1): $(1).in $$(INC_FILES)

	sed $$(foreach v, $$(BUILD_MAKE_VARS), -e 's#@$$(v)@#$$($$(v))#g') <$$< >$$@

endef

Quoted 5 lines
Quoted 2 lines

could work? (This likely depends on INC_FILES to only list files which are configure generated, i.e. wouldn't be updated by a make rule.)

And who is setting BUILD_MAKE_VARS? You didn't think the snippet doing that should be there.

I didn't mean to replace how that's done (albeit, as indicated earlier, I think it wants doing differently). Hence I've only shown the sketch of the updated macro wrt the specific aspect above. (Or am I misunderstanding your reply?)

Quoted 2 lines

And TBH: any setting from Paths.mk colliding with something else would _really_ be worrying.

No, why? Those settings should all be fine to use in e.g. the hypervisor build system, for whatever purpose.

Jan

#15 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

In reply to Juergen Gross

Config.mk define move-if-changed · line 165

Quoted 10 lines · Juergen Gross
Config.mk +4 -0
@@ -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
+INC_FILES = $(foreach f, $(PATH_FILES), $(XEN_ROOT)/config/$(f).mk)
+
+include $(INC_FILES)

And now a failing build tells me why by a gut feeling I didn't like this. Being placed here, it affects the hypervisor build as well. The hypervisor build, in its _install rule, uses $(DEBUG_DIR), first in

	[ -d "$(D)$(DEBUG_DIR)" ] || $(INSTALL_DIR) $(D)$(DEBUG_DIR)

$(D) is an absolute directory (shorthand for $(DESTDIR)). $(DEBUG_DIR) as set by Paths.mk is, too. Both point into the build tree. The two simply shouldn't be glued together.

Note that the earlier

	[ -d $(D)$(BOOT_DIR) ] || $(INSTALL_DIR) $(D)$(BOOT_DIR)

continues to be working fine, as BOOT_DIR continues to be controlled by config/StdGNU.mk. Its DEBUG_DIR isn't taking effect anymore, when for the hypervisor build it should.

And of course behavior now differs between building xen/ in a tree where tools/ was built before vs in an otherwise clean tree.

Jan

#16 lore raw

Re: [PATCH v3 1/4] build: add make macro for making file from file.in

Quoted 24 lines · Jan Beulich

Config.mk define move-if-changed · line 165

Quoted 10 lines · Juergen Gross
Config.mk +4 -0
@@ -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
+INC_FILES = $(foreach f, $(PATH_FILES), $(XEN_ROOT)/config/$(f).mk)
+
+include $(INC_FILES)

And now a failing build tells me why by a gut feeling I didn't like this. Being placed here, it affects the hypervisor build as well. The hypervisor build, in its _install rule, uses $(DEBUG_DIR), first in

	[ -d "$(D)$(DEBUG_DIR)" ] || $(INSTALL_DIR) $(D)$(DEBUG_DIR)

$(D) is an absolute directory (shorthand for $(DESTDIR)). $(DEBUG_DIR) as set by Paths.mk is, too. Both point into the build tree. The two simply shouldn't be glued together.

Note that the earlier

Quoted 8 lines
	[ -d $(D)$(BOOT_DIR) ] || $(INSTALL_DIR) $(D)$(BOOT_DIR)

continues to be working fine, as BOOT_DIR continues to be controlled by config/StdGNU.mk. Its DEBUG_DIR isn't taking effect anymore, when for the hypervisor build it should.

And of course behavior now differs between building xen/ in a tree where tools/ was built before vs in an otherwise clean tree.

Below is what I'm testing as a workaround, but I'm neither sure it's reasonable to do something like this upstream, nor am I fully convinced of its correctness just yet. The shim build looks to be working fine, which is where I was concerned the most.

Jan

Config.mk +2 -0
@@ -191,7 +191,9 @@ endef
 PATH_FILES := Paths.mk
 INC_FILES = $(foreach f, $(PATH_FILES), $(XEN_ROOT)/config/$(f))
 
+ifndef XEN_FULLVERSION
 -include $(INC_FILES)
+endif
 
 BUILD_MAKE_VARS = $(foreach f, $(PATH_FILES), $(shell awk '$$2 == ":=" { print $$1; }' $(XEN_ROOT)/config/$(f).in))
 
#17 lore raw

PATCH v3 2/4 docs: replace @xxx@ markers at build time

In reply to Juergen Gross

Use the apply-build-vars make macro to replace the @xxx@ markers in *.in files only at build time.

This allows to change the affected document files without having to run "configure" for making the change effective.

While at it add the generated files to the distclean make target.

---
V2:
- don't rename source files
V3:
- rename IN_FILES to IN_TARGETS (Jan Beulich)
- add only one file to IN_TARGETS per line (Andrew Cooper)
- use $(RM) instead of rm -f (Andrew Cooper)

---
 docs/Makefile     | 11 ++++++++++-
 docs/configure    |  7 +------
 docs/configure.ac |  9 +--------
 3 files changed, 12 insertions(+), 15 deletions(-)
docs/Makefile +10 -1
index 37776d303c..8e68300e3b 100644
@@ -8,8 +8,14 @@ DATE		:= $(call date,"+%Y-%m-%d")
 DOC_ARCHES      := arm ppc riscv x86_32 x86_64
 MAN_SECTIONS    := 1 5 7 8
 
+IN_TARGETS := man/xl-disk-configuration.5.pod
+IN_TARGETS += man/xl-network-configuration.5.pod
+IN_TARGETS += man/xl.1.pod
+IN_TARGETS += man/xl.cfg.5.pod
+IN_TARGETS += man/xl.conf.5.pod
+
 # Documentation sources to build
-MAN-SRC-y := $(sort $(basename $(wildcard man/*.pod man/*.pandoc)))
+MAN-SRC-y := $(sort $(basename $(wildcard man/*.pod man/*.pandoc) $(IN_TARGETS)))
 
 RST-SRC-y := $(sort $(filter-out %index.rst,$(shell find * -type f -name '*.rst' -print)))
 
@@ -77,11 +83,14 @@ clean: clean-man-pages
 distclean: clean
 	rm -rf $(XEN_ROOT)/config/Docs.mk config.log config.status config.cache \
 		autom4te.cache
+	$(RM) $(IN_TARGETS)
 
 # Top level install targets
 
 .PHONY: man-pages install-man-pages clean-man-pages uninstall-man-pages
 
+$(foreach file,$(IN_TARGETS),$(eval $(call apply-build-vars,$(file))))
+
 # Metarules for generating manpages.  Run with $(1) substitued for section
 define GENERATE_MANPAGE_RULES
 
docs/configure +1 -6
index 98dda3cd0f..8871914dcb 100755
@@ -1794,7 +1794,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-ac_config_files="$ac_config_files ../config/Docs.mk man/xl.cfg.5.pod man/xl.1.pod man/xl-disk-configuration.5.pod man/xl-network-configuration.5.pod man/xl.conf.5.pod"
+ac_config_files="$ac_config_files ../config/Docs.mk"
 
 
 
@@ -3063,11 +3063,6 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "../config/Docs.mk") CONFIG_FILES="$CONFIG_FILES ../config/Docs.mk" ;;
-    "man/xl.cfg.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl.cfg.5.pod" ;;
-    "man/xl.1.pod") CONFIG_FILES="$CONFIG_FILES man/xl.1.pod" ;;
-    "man/xl-disk-configuration.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl-disk-configuration.5.pod" ;;
-    "man/xl-network-configuration.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl-network-configuration.5.pod" ;;
-    "man/xl.conf.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl.conf.5.pod" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
docs/configure.ac +1 -8
index c2e5edd3b3..43dc516056 100644
@@ -5,14 +5,7 @@ AC_PREREQ([2.67])
 AC_INIT([Xen Hypervisor Documentation], m4_esyscmd([../version.sh ../xen/Makefile]),
     [[email protected]], [xen], [https://www.xen.org/])
 AC_CONFIG_SRCDIR([misc/xen-command-line.pandoc])
-AC_CONFIG_FILES([
-../config/Docs.mk
-man/xl.cfg.5.pod
-man/xl.1.pod
-man/xl-disk-configuration.5.pod
-man/xl-network-configuration.5.pod
-man/xl.conf.5.pod
-])
+AC_CONFIG_FILES([../config/Docs.mk])
 AC_CONFIG_AUX_DIR([../])
 
 # M4 Macro includes
Signature · 1 line
2.51.0
#18 lore raw

PATCH v3 3/4 config: remove unused paths from config/Paths.mk.in

In reply to Juergen Gross

Some paths in config/Paths.mk.in are used nowhere, so remove them.

---
V3:
- remove htmldir, too (Andrew Cooper)

---
 config/Paths.mk.in | 6 ------
 1 file changed, 6 deletions(-)
config/Paths.mk.in +0 -6
index bc42748b7a..6aa392b9f2 100644
@@ -20,10 +20,6 @@ libexecdir               := @libexecdir@
 datarootdir              := @datarootdir@
 mandir                   := @mandir@
 docdir                   := @docdir@
-dvidir                   := @dvidir@
-htmldir                  := @htmldir@
-pdfdir                   := @pdfdir@
-psdir                    := @psdir@
 includedir               := @includedir@
 localstatedir            := @localstatedir@
 sysconfdir               := @sysconfdir@
@@ -34,8 +30,6 @@ LIBEXEC_LIB              := @LIBEXEC_LIB@
 LIBEXEC_INC              := @LIBEXEC_INC@
 
 SHAREDIR                 := @SHAREDIR@
-MAN1DIR                  := $(mandir)/man1
-MAN8DIR                  := $(mandir)/man8
 
 XEN_RUN_DIR              := @XEN_RUN_DIR@
 XEN_LOG_DIR              := @XEN_LOG_DIR@
Signature · 1 line
2.51.0
#19 lore raw

PATCH v3 4/4 tools: replace @xxx@ markers at build time

In reply to Juergen Gross

Use the apply-build-vars make macro to replace the @xxx@ markers in most *.in files only at build time.

As some of the markers are local to tools/configure, introduce config/Tools-paths.mk.in and add the related make variables to it. Add Tools-paths to the PATH_FILES make variable in order to include the definitions for replacing them in the *.in files.

Add the generated files to the distclean target.

---
V2:
- don't rename source files
V3:
- add Tools-paths to PATH_FILES only in tools/Rules.mk (Jan Beulich)
- rename IN_FILES to IN_TARGETS (Jan Beulich)
- add only one file to IN_TARGETS per line (Andrew Cooper)
- add build target depending on generated files (Andrew Cooper)
- use $(RM) instead of rm -f (Andrew Cooper)

---
 .gitignore                     |  1 +
 config/Tools-paths.mk.in       | 10 ++++++++++
 tools/Rules.mk                 |  4 ++++
 tools/configure                | 21 ++-------------------
 tools/configure.ac             | 19 +------------------
 tools/hotplug/FreeBSD/Makefile | 13 +++++++++++--
 tools/hotplug/Linux/Makefile   | 21 +++++++++++++++++++--
 tools/hotplug/NetBSD/Makefile  | 13 +++++++++++--
 tools/hotplug/common/Makefile  | 10 +++++++++-
 tools/ocaml/libs/xs/Makefile   |  9 +++++++++
 tools/ocaml/xenstored/Makefile | 10 +++++++++-
 11 files changed, 86 insertions(+), 45 deletions(-)
 create mode 100644 config/Tools-paths.mk.in
.gitignore +1 -0
index d83427aba8..57d54f676f 100644
@@ -47,6 +47,7 @@ config.status
 config.cache
 config/Toplevel.mk
 config/Paths.mk
+config/Tools-paths.mk
 
 dist/*
 extras/
config/Tools-paths.mk.in new file +10 -0
new file mode 100644
index 0000000000..ac6298e761
@@ -0,0 +1,10 @@
+-include $(XEN_ROOT)/config/Paths.mk
+
+XENSTORED                := @XENSTORED@
+XENSTORED_KVA            := @XENSTORED_KVA@
+XENSTORED_PORT           := @XENSTORED_PORT@
+XEN_RUN_STORED           := @XEN_RUN_STORED@
+
+LINUX_BACKEND_MODULES    := @LINUX_BACKEND_MODULES@
+
+qemu_xen_path            := @qemu_xen_path@
tools/Rules.mk +4 -0
index 725c3c32e9..c3afc836ba 100644
@@ -11,6 +11,10 @@ XEN_FULLVERSION=$(shell env \
     XEN_VENDORVERSION=$(XEN_VENDORVERSION) \
     $(SHELL) $(XEN_ROOT)/version.sh --full $(XEN_ROOT)/xen/Makefile)
 
+PATH_FILES += Tools-paths
+
+-include $(XEN_ROOT)/config/Tools-paths.mk
+
 export _INSTALL := $(INSTALL)
 INSTALL = $(XEN_ROOT)/tools/cross-install
 
tools/configure +2 -19
index 3111f5688c..479c7c9a3c 100755
@@ -2742,7 +2742,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-ac_config_files="$ac_config_files ../config/Tools.mk hotplug/common/hotplugpath.sh hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/launch-xenstore hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain ocaml/libs/xs/paths.ml ocaml/xenstored/paths.ml ocaml/xenstored/oxenstored.conf"
+ac_config_files="$ac_config_files ../config/Tools.mk ../config/Tools-paths.mk"
 
 ac_config_headers="$ac_config_headers config.h"
 
@@ -11268,24 +11268,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "../config/Tools.mk") CONFIG_FILES="$CONFIG_FILES ../config/Tools.mk" ;;
-    "hotplug/common/hotplugpath.sh") CONFIG_FILES="$CONFIG_FILES hotplug/common/hotplugpath.sh" ;;
-    "hotplug/FreeBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/FreeBSD/rc.d/xencommons" ;;
-    "hotplug/FreeBSD/rc.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/FreeBSD/rc.d/xendriverdomain" ;;
-    "hotplug/Linux/init.d/sysconfig.xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/sysconfig.xencommons" ;;
-    "hotplug/Linux/init.d/sysconfig.xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/sysconfig.xendomains" ;;
-    "hotplug/Linux/init.d/xen-watchdog") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xen-watchdog" ;;
-    "hotplug/Linux/init.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xencommons" ;;
-    "hotplug/Linux/init.d/xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xendomains" ;;
-    "hotplug/Linux/init.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xendriverdomain" ;;
-    "hotplug/Linux/launch-xenstore") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/launch-xenstore" ;;
-    "hotplug/Linux/vif-setup") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/vif-setup" ;;
-    "hotplug/Linux/xen-hotplug-common.sh") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xen-hotplug-common.sh" ;;
-    "hotplug/Linux/xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xendomains" ;;
-    "hotplug/NetBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xencommons" ;;
-    "hotplug/NetBSD/rc.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xendriverdomain" ;;
-    "ocaml/libs/xs/paths.ml") CONFIG_FILES="$CONFIG_FILES ocaml/libs/xs/paths.ml" ;;
-    "ocaml/xenstored/paths.ml") CONFIG_FILES="$CONFIG_FILES ocaml/xenstored/paths.ml" ;;
-    "ocaml/xenstored/oxenstored.conf") CONFIG_FILES="$CONFIG_FILES ocaml/xenstored/oxenstored.conf" ;;
+    "../config/Tools-paths.mk") CONFIG_FILES="$CONFIG_FILES ../config/Tools-paths.mk" ;;
     "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
     "hotplug/Linux/systemd/proc-xen.mount") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/proc-xen.mount" ;;
     "hotplug/Linux/systemd/xen-init-dom0.service") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/xen-init-dom0.service" ;;
tools/configure.ac +1 -18
index 285b4ea128..ecd45e782e 100644
@@ -7,24 +7,7 @@ AC_INIT([Xen Hypervisor Tools], m4_esyscmd([../version.sh ../xen/Makefile]),
 AC_CONFIG_SRCDIR([libs/light/libxl.c])
 AC_CONFIG_FILES([
 ../config/Tools.mk
-hotplug/common/hotplugpath.sh
-hotplug/FreeBSD/rc.d/xencommons
-hotplug/FreeBSD/rc.d/xendriverdomain
-hotplug/Linux/init.d/sysconfig.xencommons
-hotplug/Linux/init.d/sysconfig.xendomains
-hotplug/Linux/init.d/xen-watchdog
-hotplug/Linux/init.d/xencommons
-hotplug/Linux/init.d/xendomains
-hotplug/Linux/init.d/xendriverdomain
-hotplug/Linux/launch-xenstore
-hotplug/Linux/vif-setup
-hotplug/Linux/xen-hotplug-common.sh
-hotplug/Linux/xendomains
-hotplug/NetBSD/rc.d/xencommons
-hotplug/NetBSD/rc.d/xendriverdomain
-ocaml/libs/xs/paths.ml
-ocaml/xenstored/paths.ml
-ocaml/xenstored/oxenstored.conf
+../config/Tools-paths.mk
 ])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_AUX_DIR([../])
tools/hotplug/FreeBSD/Makefile +11 -2
index a6552c9884..a7c1c461ef 100644
@@ -8,9 +8,17 @@ XEN_SCRIPT_DATA :=
 
 XEN_RCD_PROG := rc.d/xencommons rc.d/xendriverdomain
 
+IN_TARGETS := rc.d/xencommons
+IN_TARGETS += rc.d/xendriverdomain
+
 .PHONY: all
 all:
 
+$(foreach file,$(IN_TARGETS),$(eval $(call apply-build-vars,$(file))))
+
+.PHONY: build
+build: $(IN_TARGETS)
+
 .PHONY: install
 install: install-scripts install-rcd
 
@@ -18,7 +26,7 @@ install: install-scripts install-rcd
 uninstall: uninstall-script uninstall-rcd
 
 .PHONY: install-scripts
-install-scripts:
+install-scripts: build
 	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
 	   do \
@@ -35,7 +43,7 @@ uninstall-scripts:
 	rm -f $(addprefix $(DESTDIR)$(XEN_SCRIPT_DIR)/, $(XEN_SCRIPT_DATA))
 
 .PHONY: install-rcd
-install-rcd:
+install-rcd: build
 	$(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	set -e; for i in $(XEN_RCD_PROG); \
 	   do \
@@ -51,3 +59,4 @@ clean:
 
 .PHONY: distclean
 distclean: clean
+	$(RM) $(IN_TARGETS)
tools/hotplug/Linux/Makefile +19 -2
index 9a7b3a3515..b60e39e1cd 100644
@@ -26,9 +26,25 @@ XEN_SCRIPT_DATA := xen-script-common.sh locking.sh logging.sh
 XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
 XEN_SCRIPT_DATA += block-common.sh
 
+IN_TARGETS := launch-xenstore
+IN_TARGETS += vif-setup
+IN_TARGETS += xendomains
+IN_TARGETS += xen-hotplug-common.sh
+IN_TARGETS += init.d/sysconfig.xendomains
+IN_TARGETS += init.d/xen-watchdog
+IN_TARGETS += init.d/xencommons
+IN_TARGETS += init.d/xendomains
+IN_TARGETS += init.d/xendriverdomain
+IN_TARGETS += init.d/sysconfig.xencommons
+
 .PHONY: all
 all: subdirs-all
 
+$(foreach file,$(IN_TARGETS),$(eval $(call apply-build-vars,$(file))))
+
+.PHONY: build
+build: $(IN_TARGETS)
+
 .PHONY: install
 install: install-initd install-scripts subdirs-install
 
@@ -37,7 +53,7 @@ uninstall: uninstall-initd uninstall-scripts subdirs-uninstall
 
 # See docs/misc/distro_mapping.txt for INITD_DIR location
 .PHONY: install-initd
-install-initd:
+install-initd: build
 	$(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	$(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
@@ -60,7 +76,7 @@ uninstall-initd:
 	rm -f $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
 
 .PHONY: install-scripts
-install-scripts:
+install-scripts: build
 	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
 	    do \
@@ -81,3 +97,4 @@ clean: subdirs-clean
 
 .PHONY: distclean
 distclean: clean
+	$(RM) $(IN_TARGETS)
tools/hotplug/NetBSD/Makefile +11 -2
index 1cd3db2ccb..8ae788131e 100644
@@ -12,9 +12,17 @@ XEN_SCRIPTS += qemu-ifup
 XEN_SCRIPT_DATA :=
 XEN_RCD_PROG := rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
 
+IN_TARGETS := rc.d/xencommons
+IN_TARGETS += rc.d/xendriverdomain
+
 .PHONY: all
 all:
 
+$(foreach file,$(IN_TARGETS),$(eval $(call apply-build-vars,$(file))))
+
+.PHONY: build
+build: $(IN_TARGETS)
+
 .PHONY: install
 install: install-scripts install-rcd
 
@@ -22,7 +30,7 @@ install: install-scripts install-rcd
 uninstall: uninstall-scripts uninstall-rcd
 
 .PHONY: install-scripts
-install-scripts:
+install-scripts: build
 	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
 	   do \
@@ -39,7 +47,7 @@ uninstall-scripts:
 	rm -f $(addprefix $(DESTDIR)$(XEN_SCRIPT_DIR)/, $(XEN_SCRIPT_DATA))
 
 .PHONY: install-rcd
-install-rcd:
+install-rcd: build
 	$(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	set -e; for i in $(XEN_RCD_PROG); \
 	   do \
@@ -57,3 +65,4 @@ clean:
 
 .PHONY: distclean
 distclean: clean
+	$(RM) $(IN_TARGETS)
tools/hotplug/common/Makefile +9 -1
index 62afe1019e..3b0b5a0296 100644
@@ -7,8 +7,15 @@ include $(XEN_ROOT)/tools/Rules.mk
 XEN_SCRIPTS :=
 XEN_SCRIPT_DATA := hotplugpath.sh
 
+IN_TARGETS := hotplugpath.sh
+
 .PHONY: all
-all:
+all: build
+
+$(foreach file,$(IN_TARGETS),$(eval $(call apply-build-vars,$(file))))
+
+.PHONY: build
+build: $(IN_TARGETS)
 
 .PHONY: install
 install: install-scripts
@@ -38,3 +45,4 @@ clean:
 
 .PHONY: distclean
 distclean: clean
+	$(RM) $(IN_TARGETS)
tools/ocaml/libs/xs/Makefile +9 -0
index e160e6a711..b0963611fb 100644
@@ -8,6 +8,8 @@ OCAMLOPTFLAGS += -for-pack Xenstore
 .NOTPARALLEL:
 # Ocaml is such a PITA!
 
+IN_TARGETS := paths.ml
+
 PREINTF = xsraw.cmi xst.cmi
 PREOBJS = queueop xsraw xst
 PRELIBS = $(foreach obj, $(PREOBJS),$(obj).cmo) $(foreach obj,$(PREOJBS),$(obj).cmx)
@@ -17,6 +19,10 @@ LIBS = xenstore.cma xenstore.cmxa
 
 all: $(PREINTF) $(PRELIBS) $(INTF) $(LIBS) $(PROGRAMS)
 
+$(foreach file,$(IN_TARGETS),$(eval $(call apply-build-vars,$(file))))
+
+$(OBJS): $(IN_TARGETS)
+
 bins: $(PROGRAMS)
 
 libs: $(LIBS)
@@ -43,4 +49,7 @@ install: $(LIBS) META
 uninstall:
 	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenstore
 
+.PHONY: distclean
+	$(RM) $(IN_TARGETS)
+
 include $(OCAML_TOPLEVEL)/Makefile.rules
tools/ocaml/xenstored/Makefile +9 -1
index c333394a34..b3d1a8b8de 100644
@@ -72,6 +72,9 @@ XENSTOREDLIBS = \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xsd_glue $(OCAML_TOPLEVEL)/libs/xsd_glue/plugin_interface_v1.cmxa \
 	-ccopt -L -ccopt $(XEN_ROOT)/tools/libs/ctrl
 
+IN_TARGETS := paths.ml
+IN_TARGETS += oxenstored.conf
+
 PROGRAMS = oxenstored
 
 oxenstored_LIBS = $(XENSTOREDLIBS)
@@ -83,7 +86,9 @@ oxenstored_OBJS = $(oxenstored_MLSORTED:.ml=)
 
 OCAML_PROGRAM = oxenstored
 
-all: $(INTF) $(LIBS) $(PROGRAMS)
+all: $(IN_TARGETS) $(INTF) $(LIBS) $(PROGRAMS)
+
+$(foreach file,$(IN_TARGETS),$(eval $(call apply-build-vars,$(file))))
 
 bins: $(PROGRAMS)
 
@@ -99,4 +104,7 @@ uninstall:
 	rm -f $(DESTDIR)$(XEN_CONFIG_DIR)/oxenstored.conf
 	rm -f $(DESTDIR)$(sbindir)/oxenstored
 
+distclean:
+	$(RM) $(IN_TARGETS)
+
 include $(OCAML_TOPLEVEL)/Makefile.rules
Signature · 1 line
2.51.0