aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile.local27
-rw-r--r--doc/mkdocdeps.py13
2 files changed, 39 insertions, 1 deletions
diff --git a/doc/Makefile.local b/doc/Makefile.local
index 47192473..fd64f708 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -8,6 +8,7 @@ SPHINXBUILD = sphinx-build
DOCBUILDDIR := $(dir)/_build
prerst2man := python $(dir)/prerst2man.py
+mkdocdeps := python $(dir)/mkdocdeps.py
# Internal variables.
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)
@@ -15,6 +16,11 @@ ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)
.PHONY: sphinx-html sphinx-man sphinx-texinfo sphinx-info
.PHONY: rst2man
+.PHONY: install-man
+
+%.gz: %
+ rm -f $@ && gzip --stdout $^ > $@
+
sphinx-html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html
@@ -31,4 +37,23 @@ sphinx-info: sphinx-texinfo
rst2man:
$(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man
-CLEAN := $(CLEAN) $(DOCBUILDDIR)
+-include $(dir)/docdeps.mk
+
+MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
+
+${MAN_ROFF_FILES} : sphinx-man
+
+install-man: ${MAN_GZIP_FILES}
+ mkdir -p "$(DESTDIR)$(mandir)/man1"
+ mkdir -p "$(DESTDIR)$(mandir)/man5"
+ mkdir -p "$(DESTDIR)$(mandir)/man7"
+ install -m0644 $(DOCBUILDDIR)/man/*.1.gz $(DESTDIR)/$(mandir)/man1
+ install -m0644 $(DOCBUILDDIR)/man/*.5.gz $(DESTDIR)/$(mandir)/man5
+ 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
diff --git a/doc/mkdocdeps.py b/doc/mkdocdeps.py
new file mode 100644
index 00000000..2f4a9596
--- /dev/null
+++ b/doc/mkdocdeps.py
@@ -0,0 +1,13 @@
+from sys import argv
+conffile = argv[1]
+builddir = argv[2]
+outfile = argv[3]
+
+execfile(conffile)
+
+roff_files = []
+out=open(outfile,'w')
+for page in man_pages:
+ roff_files = roff_files + ["{0:s}/man/{1:s}.{2:d}".format(builddir,page[1],page[4])]
+
+out.write ('MAN_ROFF_FILES := ' + ' \\\n\t'.join(roff_files)+'\n')