[libvirt] [PATCH 18/25] src: hyperv: generate source files into build directory

Pavel Hrdina phrdina at redhat.com
Mon Oct 21 08:00:43 UTC 2019


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/hyperv/Makefile.inc.am         |  5 +++--
 src/hyperv/hyperv_wmi_generator.py | 11 +++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

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