notmuch/doc/Makefile.local
David Bremner 6f8daa3989 doc: install sphinx version of man pages
The python script mkdocdeps.py is used to import the list of man pages
from the sphinx configuration to make.

This will delete the (release only) target update-man-versions. This
will be replaced in a followup commit.
2014-03-09 10:41:09 -03:00

59 lines
1.5 KiB
Makefile

# -*- makefile -*-
dir := doc
# You can set these variables from the command line.
SPHINXOPTS := -q -c $(dir)
SPHINXBUILD = sphinx-build
DOCBUILDDIR := $(dir)/_build
prerst2man := python $(dir)/prerst2man.py
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: install-man
%.gz: %
rm -f $@ && gzip --stdout $^ > $@
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
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