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

[libvirt] [PATCH] build: Fix VPATH build



Even VPATH make dist succeeds now
---
 docs/Makefile.am |    8 ++++----
 docs/apibuild.py |   23 +++++++++++++----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/docs/Makefile.am b/docs/Makefile.am
index 473bbbf..8c96e79 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -92,7 +92,7 @@ MAINTAINERCLEANFILES = $(dot_html) $(apihtml) $(devhelphtml)
 
 all: web
 
-api: libvirt-api.xml libvirt-refs.xml
+api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
 
 web: $(dot_html) html/index.html devhelp/index.html
 
@@ -146,7 +146,7 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
 html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in
 	- if [ -x $(XSLTPROC) ] ; then \
 	  echo "Rebuilding the HTML pages from the XML API" ; \
-	  $(XSLTPROC) --nonet $(srcdir)/newapi.xsl libvirt-api.xml ; fi
+	  $(XSLTPROC) --nonet $(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi
 	- if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \
 	  if $(XMLCATALOG) '$(XML_CATALOG_FILE)' "-//W3C//DTD XHTML 1.0 Strict//EN" \
 	    > /dev/null ; then \
@@ -159,7 +159,7 @@ $(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
 	- echo Rebuilding devhelp files
 	- if [ -x $(XSLTPROC) ] ; then \
 	  $(XSLTPROC) --nonet -o devhelp/libvirt.devhelp \
-	  $(top_srcdir)/docs/devhelp/devhelp.xsl libvirt-api.xml ; fi
+	  $(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; fi
 
 python_generated_files = \
 		$(srcdir)/html/libvirt-libvirt.html \
@@ -179,7 +179,7 @@ clean-local:
 	rm -f *~ *.bak *.hierarchy *.signals *-unused.txt *.html
 
 maintainer-clean-local: clean-local
-	rm -rf libvirt-api.xml libvirt-refs.xml todo.html.in
+	rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml todo.html.in
 
 rebuild: api all
 
diff --git a/docs/apibuild.py b/docs/apibuild.py
index 62b7557..895a313 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -1614,8 +1614,9 @@ class CParser:
 
 class docBuilder:
     """A documentation builder"""
-    def __init__(self, name, directories=['.'], includes=[]):
+    def __init__(self, name, path='.', directories=['.'], includes=[]):
         self.name = name
+        self.path = path
         self.directories = directories
 	self.includes = includes + included_files.keys()
 	self.modules = {}
@@ -2062,7 +2063,7 @@ class docBuilder:
 	output.write("  </index>\n")
 
     def serialize(self):
-        filename = "%s-api.xml" % self.name
+        filename = "%s/%s-api.xml" % (self.path, self.name)
         print "Saving XML description %s" % (filename)
         output = open(filename, "w")
         output.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
@@ -2098,7 +2099,7 @@ class docBuilder:
         output.write("</api>\n")
         output.close()
 
-        filename = "%s-refs.xml" % self.name
+        filename = "%s/%s-refs.xml" % (self.path, self.name)
         print "Saving XML Cross References %s" % (filename)
         output = open(filename, "w")
         output.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
@@ -2113,14 +2114,16 @@ def rebuild():
     srcdir = os.environ["srcdir"]
     if glob.glob(srcdir + "/../src/libvirt.c") != [] :
         print "Rebuilding API description for libvirt"
-	builder = docBuilder("libvirt",
-                             [srcdir + "/../src",
-                              srcdir + "/../src/util",
-                              srcdir + "/../include/libvirt"],
-                             [])
+        dirs = [srcdir + "/../src",
+                srcdir + "/../src/util",
+                srcdir + "/../include/libvirt"]
+        if glob.glob(srcdir + "/../include/libvirt/libvirt.h") == [] :
+            dirs.append("../include/libvirt")
+        builder = docBuilder("libvirt", srcdir, dirs, [])
     elif glob.glob("src/libvirt.c") != [] :
-        print "Rebuilding API description for libvir"
-	builder = docBuilder("libvirt", ["src", "src/util", "include/libvirt"],
+        print "Rebuilding API description for libvirt"
+        builder = docBuilder("libvirt", srcdir,
+                             ["src", "src/util", "include/libvirt"],
 	                     [])
     else:
         print "rebuild() failed, unable to guess the module"
-- 
1.7.4.1


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