aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/Makefile.local
diff options
context:
space:
mode:
authorGravatar David Bremner <david@tethera.net>2014-03-13 00:21:14 -0300
committerGravatar David Bremner <david@tethera.net>2014-03-18 07:38:57 -0300
commit9d9a700f1de6352b4f51a00ab80f2fcd70da050d (patch)
tree639ac019896790b78a86e4443e607f1e5706aa41 /doc/Makefile.local
parent3fed6736a7ef8b8b1f05d0fabb136bdd3b5917ee (diff)
doc: build man pages at build time; introduce HAVE_SPHINX, HAVE_RST2MAN
This helps avoid build artifacts (namely, nroff and gzipped-nroff man pages) owned by root. The variables allow choosing which generator to use for the man page. These will be hooked to configure in a following commit.
Diffstat (limited to 'doc/Makefile.local')
-rw-r--r--doc/Makefile.local31
1 files changed, 18 insertions, 13 deletions
diff --git a/doc/Makefile.local b/doc/Makefile.local
index fd64f708..23f40952 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -13,10 +13,9 @@ mkdocdeps := python $(dir)/mkdocdeps.py
# Internal variables.
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)
-.PHONY: sphinx-html sphinx-man sphinx-texinfo sphinx-info
-.PHONY: rst2man
+.PHONY: sphinx-html sphinx-texinfo sphinx-info
-.PHONY: install-man
+.PHONY: install-man build-man
%.gz: %
rm -f $@ && gzip --stdout $^ > $@
@@ -24,24 +23,30 @@ ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)
sphinx-html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html
-sphinx-man:
- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
-
sphinx-texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo
sphinx-info: sphinx-texinfo
make -C $(DOCBUILDDIR)/texinfo info
-# fallback target in case sphinx not installed
-rst2man:
- $(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man
-
-include $(dir)/docdeps.mk
MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
-${MAN_ROFF_FILES} : sphinx-man
+build-man: ${MAN_GZIP_FILES}
+
+${MAN_ROFF_FILES}: ${dir}/man.stamp
+
+$(dir)/man.stamp: ${MAN_RST_FILES}
+ifeq ($(HAVE_SPHINX),1)
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
+ touch $@
+else ifeq ($(HAVE_RST2MAN),1)
+ $(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man
+ touch $@
+else
+ @echo "No sphinx or rst2man, will not install man pages."
+endif
install-man: ${MAN_GZIP_FILES}
mkdir -p "$(DESTDIR)$(mandir)/man1"
@@ -52,8 +57,8 @@ install-man: ${MAN_GZIP_FILES}
install -m0644 $(DOCBUILDDIR)/man/*.7.gz $(DESTDIR)/$(mandir)/man7
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
-
$(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py
$(mkdocdeps) $< $(DOCBUILDDIR) $@
-CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk
+CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk $(dir)/man.stamp
+CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES)