]> xenbits.xensource.com Git - xen.git/commitdiff
oxenstored: generate a paths module
authorWei Liu <wei.liu2@citrix.com>
Mon, 13 Jun 2016 07:49:00 +0000 (08:49 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 14 Jun 2016 13:31:27 +0000 (14:31 +0100)
That file includes all paths generated by configure. It will be used to
get rid of hard-coded paths in code.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: David Scott <dave@recoil.org>
.gitignore
tools/ocaml/Makefile.rules
tools/ocaml/xenstored/Makefile

index 39deb2d3394bf9d935859a18a534628680a30e7e..e4afda31d4d41034954d7b4bc699cc327d2bf9c2 100644 (file)
@@ -347,6 +347,7 @@ tools/ocaml/libs/xentoollog/xentoollog.ml
 tools/ocaml/libs/xentoollog/xentoollog.mli
 tools/ocaml/xenstored/oxenstored
 tools/ocaml/xenstored/oxenstored.conf
+tools/ocaml/xenstored/paths.ml
 tools/ocaml/test/xtl
 tools/ocaml/test/send_debug_keys
 tools/ocaml/test/list_domains
index 179606047e44bbde3e78e125c2165858ca95a38a..a893c42b437899c022711307420dbc083c9e9fe9 100644 (file)
@@ -95,3 +95,14 @@ $(foreach lib,$(OCAML_LIBRARY),$(eval $(call OCAML_LIBRARY_template,$(lib))))
 $(foreach lib,$(OCAML_NOC_LIBRARY),$(eval $(call OCAML_NOC_LIBRARY_template,$(lib))))
 $(foreach p,$(OCAML_PROGRAM),$(eval $(call OCAML_PROGRAM_template,$(p))))
 $(foreach p,$(C_PROGRAM),$(eval $(call C_PROGRAM_template,$(p))))
+
+buildmakevars2module = $(eval $(call buildmakevars2module-closure,$(1)))
+define buildmakevars2module-closure
+    $(1): .phony
+       rm -f $(1).tmp; \
+       $(foreach var, $(BUILD_MAKE_VARS), \
+                 printf "let %s = \"%s\";;\n" \
+                      $(shell echo $(var) | tr '[:upper:]' '[:lower:]') \
+                      $($(var)) >>$(1).tmp;) \
+       $(call move-if-changed,$(1).tmp,$(1))
+endef
index dce9e7014d09d22c527291e46e2994a34943fff5..939dcaa987435f38557e8f24a6cd9fc0970060d4 100644 (file)
@@ -32,7 +32,8 @@ OCAML_LIBRARY += systemd
 
 LIBS_systemd += $(LDFLAGS-y)
 
-OBJS = define \
+OBJS = paths \
+       define \
        stdext \
        trie \
        config \
@@ -87,3 +88,8 @@ install: all
        $(INSTALL_DATA) oxenstored.conf $(DESTDIR)$(XEN_CONFIG_DIR)
 
 include $(OCAML_TOPLEVEL)/Makefile.rules
+
+genpath-target = $(call buildmakevars2module,paths.ml)
+$(eval $(genpath-target))
+
+GENERATED_FILES += paths.ml