From a2d917f34960d0bcb55f299adfda77dc9bb93200 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 8 Feb 2011 12:04:11 +0100
Subject: [PATCH] Fix html docs builds

This fixes the doc builds broken by commit b292b986, but is only an
ugly workaround due to our dependency chain.

opcodes.py imports (both directly and indirectly) constants.py, which
imports _autoconf.py. Hence one could say that all .py files have a
logical dependency on _autoconf.py, since you can't "import opcodes"
before _autoconf.py is built. So the sphinx rule should depend on
_autoconf.py as a prerequisite.

But we can't use a normal prerequisite, since that would cause the
html docs to be rebuilt whenever _autoconf.py gets rebuilt, i.e. even
on end-users machines after ./configure; this is bad, and it also
breaks distcheck (as the html files are not removed in distclean,
since we do want them distributed).

So we only add an order-only prerequisite, which does the right thing
(although our dependency chain is still ugly).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>
---
 Makefile.am | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 4dada61b2..099d5d86b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -261,8 +261,14 @@ docrst = \
 
 $(RUN_IN_TEMPDIR): | $(all_dirfiles)
 
+# Note: we use here an order-only prerequisite, as the contents of
+# _autoconf.py are not actually influencing the html build output: it
+# 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) $(docpng) doc/conf.py configure.ac \
-	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py
+	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
+	| lib/_autoconf.py
 	@test -n "$(SPHINX)" || \
 	    { echo 'sphinx-build' not found during configure; exit 1; }
 	@mkdir_p@ $(dir $@)
-- 
GitLab