[libvirt] [PATCH v3 14/20] src: hyperv: generate source files into build directory

Pavel Hrdina phrdina at redhat.com
Thu Oct 24 13:05:32 UTC 2019


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
Reviewed-by: Ján Tomko <jtomko at redhat.com>
---

Notes:
    Changes in v2:
        - remove entries from .gitignore

 .gitignore                         |  1 -
 src/hyperv/Makefile.inc.am         |  5 +++--
 src/hyperv/hyperv_wmi_generator.py | 11 +++++------
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore
index 46f6f98045..85a417112d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,7 +41,6 @@ Makefile.in
 # libvirt related ignores
 /build/
 /ci/scratch/
-/src/hyperv/*.generated.*
 /src/locking/lock_daemon_dispatch_stubs.h
 /src/logging/log_daemon_dispatch_stubs.h
 /src/lxc/lxc_controller_dispatch.h
diff --git a/src/hyperv/Makefile.inc.am b/src/hyperv/Makefile.inc.am
index 6728b39c90..79e94d09bb 100644
--- a/src/hyperv/Makefile.inc.am
+++ b/src/hyperv/Makefile.inc.am
@@ -41,8 +41,8 @@ $(HYPERV_DRIVER_GENERATED): $(HYPERV_GENERATED_STAMP)
 
 $(HYPERV_GENERATED_STAMP): $(srcdir)/hyperv/hyperv_wmi_generator.input \
                             $(srcdir)/hyperv/hyperv_wmi_generator.py
-	$(AM_V_GEN)srcdir=$(srcdir) $(RUNUTF8) $(PYTHON) \
-	  $(srcdir)/hyperv/hyperv_wmi_generator.py \
+	$(AM_V_GEN) $(RUNUTF8) $(PYTHON) \
+	  $(srcdir)/hyperv/hyperv_wmi_generator.py $(srcdir) $(builddir) \
 	  && touch $@
 
 MAINTAINERCLEANFILES += $(HYPERV_DRIVER_GENERATED) $(HYPERV_GENERATED_STAMP)
@@ -53,6 +53,7 @@ libvirt_la_BUILT_LIBADD += libvirt_driver_hyperv.la
 libvirt_driver_hyperv_la_CFLAGS = \
 	$(OPENWSMAN_CFLAGS) \
 	-I$(srcdir)/conf \
+	-I$(builddir)/hyperv \
 	$(AM_CFLAGS) \
 	$(NULL)
 libvirt_driver_hyperv_la_LDFLAGS = $(AM_LDFLAGS)
diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_generator.py
index a9ece0ff00..c3cd39cc76 100755
--- a/src/hyperv/hyperv_wmi_generator.py
+++ b/src/hyperv/hyperv_wmi_generator.py
@@ -454,12 +454,11 @@ def parse_class(block):
 
 
 def main():
-    if "srcdir" in os.environ:
-        input_filename = os.path.join(os.environ["srcdir"], "hyperv/hyperv_wmi_generator.input")
-        output_dirname = os.path.join(os.environ["srcdir"], "hyperv")
-    else:
-        input_filename = os.path.join(os.getcwd(), "hyperv_wmi_generator.input")
-        output_dirname = os.getcwd()
+    if len(sys.argv) != 3:
+        report_error("usage: %s srcdir builddir" % sys.argv[0])
+
+    input_filename = os.path.join(sys.argv[1], "hyperv", "hyperv_wmi_generator.input")
+    output_dirname = os.path.join(sys.argv[2], "hyperv")
 
     classes_typedef = open_and_print(os.path.join(output_dirname, "hyperv_wmi_classes.generated.typedef"))
     classes_header = open_and_print(os.path.join(output_dirname, "hyperv_wmi_classes.generated.h"))
-- 
2.21.0




More information about the libvir-list mailing list