From 7cf58cadf8f64d0d6fdd21835622a2f55a163a8f Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Wed, 9 Jan 2013 16:22:26 +0100
Subject: [PATCH] Generate documentation from build directory
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When man pages should be included they need to be copied from man/*.rst.
This means documentation can no longer be built from the static reST
files alone (which are referenced using β€œabs_top_srcdir”). Similar to
Python files, automake doesn't copy or link the input files for
documentation into the build tree.

This patch adds all files required to build the documentation to
β€œsrclink_files”, renames the β€œdocrst" variable to β€œdocinput”, and then
references the files in the build tree using β€œabs_top_builddir”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 Makefile.am | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 871f73f38..8359d6cb7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -357,7 +357,9 @@ utils_PYTHON = \
 	lib/utils/wrapper.py \
 	lib/utils/x509.py
 
-docrst = \
+docinput = \
+	doc/conf.py \
+	doc/css/style.css \
 	doc/admin.rst \
 	doc/cluster-merge.rst \
 	doc/design-2.0.rst \
@@ -583,7 +585,7 @@ $(RUN_IN_TEMPDIR): | stamp-directories
 # has to exist in order for the sphinx module to be loaded
 # successfully, but we certainly don't want the docs to be rebuilt if
 # it changes
-doc/html/index.html: $(docrst) doc/conf.py configure.ac \
+doc/html/index.html: $(docinput) doc/conf.py configure.ac \
 	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
 	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
 	doc/css/style.css \
@@ -596,7 +598,7 @@ doc/html/index.html: $(docrst) doc/conf.py configure.ac \
 	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
 	    -D release="$(PACKAGE_VERSION)" \
 	    -D graphviz_dot="$(DOT)" \
-	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
+	    $(abs_top_builddir)/doc $(CURDIR)/doc/html
 	rm -f doc/html/.buildinfo doc/html/objects.inv
 	touch $@
 
@@ -814,9 +816,7 @@ EXTRA_DIST = \
 	devel/webserver \
 	tools/kvm-ifup.in \
 	tools/vcluster-setup.in \
-	$(docrst) \
-	doc/conf.py \
-	doc/css/style.css \
+	$(docinput) \
 	doc/html \
 	$(BUILT_EXAMPLES:%=%.in) \
 	doc/examples/ganeti.default \
@@ -1121,7 +1121,8 @@ srclink_files = \
 	test/hs/offline-test.sh \
 	test/hs/cli-tests-defs.sh \
 	$(all_python_code) \
-	$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS)
+	$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS) \
+	$(docinput)
 
 check_python_code = \
 	$(BUILD_BASH_COMPLETION) \
-- 
GitLab