aboutsummaryrefslogtreecommitdiff
path: root/doc/Makefile.local
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2016-11-05 22:18:17 +0200
committerDavid Bremner <david@tethera.net>2016-11-17 08:41:24 -0400
commit76ab6e99625468b011723a6bd9d84be5fab15d02 (patch)
tree7ed8374cafcd926370f7466f439d24a99f2e6677 /doc/Makefile.local
parenta7a683b120ea8be1fe619d12a7d8a201de0652e6 (diff)
build: generate man page list from source files, not conf.py
Use $(wildcard ...) to generate the list of man pages based on the rst source files present in the man page directories, instead of reading conf.py. This has three main benefits: 1) This makes the man page build slightly less complicated and easier to understand. At least there are fewer moving parts. 2) This makes the build fail if we add a man page rst file, but fail to add it to conf.py. 3) We can use Sphinx constructs in conf.py that are not available when importing the file into a normal python program such as mkdocdeps.py.
Diffstat (limited to 'doc/Makefile.local')
-rw-r--r--doc/Makefile.local23
1 files changed, 13 insertions, 10 deletions
diff --git a/doc/Makefile.local b/doc/Makefile.local
index 5dc1cad4..8a2f656b 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -7,13 +7,23 @@ SPHINXOPTS := -q
SPHINXBUILD = sphinx-build
DOCBUILDDIR := $(dir)/_build
-mkdocdeps := $(PYTHON) $(srcdir)/$(dir)/mkdocdeps.py
-
# Internal variables.
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(srcdir)/$(dir)
APIMAN := $(DOCBUILDDIR)/man/man3/notmuch.3
DOXYFILE := $(srcdir)/$(dir)/doxygen.cfg
+MAN1_RST := $(wildcard $(srcdir)/doc/man1/*.rst)
+MAN5_RST := $(wildcard $(srcdir)/doc/man5/*.rst)
+MAN7_RST := $(wildcard $(srcdir)/doc/man7/*.rst)
+MAN_RST_FILES := $(MAN1_RST) $(MAN5_RST) $(MAN7_RST)
+
+MAN1_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN1_RST:.rst=.1))
+MAN5_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN5_RST:.rst=.5))
+MAN7_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN7_RST:.rst=.7))
+MAN_ROFF_FILES := $(MAN1_ROFF) $(MAN5_ROFF) $(MAN7_ROFF)
+
+MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
+
.PHONY: sphinx-html sphinx-texinfo sphinx-info
.PHONY: install-man build-man apidocs install-apidocs
@@ -30,10 +40,6 @@ sphinx-texinfo:
sphinx-info: sphinx-texinfo
make -C $(DOCBUILDDIR)/texinfo info
--include $(dir)/docdeps.mk
-
-MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
-
# Use the man page converter that is available. We should never depend
# on MAN_ROFF_FILES if a converter is not available.
${MAN_ROFF_FILES}: $(DOCBUILDDIR)/.roff.stamp
@@ -96,8 +102,5 @@ $(dir)/config.dox: version.stamp
echo "PROJECT_NAME = \"Notmuch $(VERSION)\"" > $@
echo "INPUT=${srcdir}/lib/notmuch.h" >> $@
-$(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py
- $(mkdocdeps) $(srcdir)/doc $(DOCBUILDDIR) $@
-
-CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk $(DOCBUILDDIR)/.roff.stamp
+CLEAN := $(CLEAN) $(DOCBUILDDIR) $(DOCBUILDDIR)/.roff.stamp
CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES) $(dir)/conf.pyc $(dir)/config.dox