2014-01-28 17:12:37 +01:00
|
|
|
# -*- makefile -*-
|
|
|
|
|
|
|
|
dir := doc
|
|
|
|
|
|
|
|
# You can set these variables from the command line.
|
2014-03-20 01:48:03 +01:00
|
|
|
SPHINXOPTS := -q
|
2014-01-28 17:12:37 +01:00
|
|
|
SPHINXBUILD = sphinx-build
|
|
|
|
DOCBUILDDIR := $(dir)/_build
|
|
|
|
|
2014-03-20 01:48:03 +01:00
|
|
|
prerst2man := python $(srcdir)/$(dir)/prerst2man.py
|
|
|
|
mkdocdeps := python $(srcdir)/$(dir)/mkdocdeps.py
|
2014-01-28 17:12:38 +01:00
|
|
|
|
2014-01-28 17:12:37 +01:00
|
|
|
# Internal variables.
|
2014-03-20 01:48:03 +01:00
|
|
|
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(srcdir)/$(dir)
|
2014-01-28 17:12:37 +01:00
|
|
|
|
2014-03-13 04:21:14 +01:00
|
|
|
.PHONY: sphinx-html sphinx-texinfo sphinx-info
|
2014-01-28 17:12:37 +01:00
|
|
|
|
2014-03-13 04:21:14 +01:00
|
|
|
.PHONY: install-man build-man
|
2014-03-05 14:34:10 +01:00
|
|
|
|
|
|
|
%.gz: %
|
|
|
|
rm -f $@ && gzip --stdout $^ > $@
|
|
|
|
|
2014-01-28 17:12:37 +01:00
|
|
|
sphinx-html:
|
|
|
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html
|
|
|
|
|
|
|
|
sphinx-texinfo:
|
|
|
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo
|
|
|
|
|
|
|
|
sphinx-info: sphinx-texinfo
|
|
|
|
make -C $(DOCBUILDDIR)/texinfo info
|
|
|
|
|
2014-03-05 14:34:10 +01:00
|
|
|
-include $(dir)/docdeps.mk
|
|
|
|
|
|
|
|
MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
|
|
|
|
|
2014-03-13 04:21:16 +01:00
|
|
|
# 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}: ${MAN_RST_FILES}
|
2014-03-13 04:21:14 +01:00
|
|
|
ifeq ($(HAVE_SPHINX),1)
|
|
|
|
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
|
2014-03-13 04:21:15 +01:00
|
|
|
for section in 1 5 7; do \
|
|
|
|
mkdir -p $(DOCBUILDDIR)/man/man$${section}; \
|
|
|
|
mv $(DOCBUILDDIR)/man/*.$${section} $(DOCBUILDDIR)/man/man$${section}; \
|
|
|
|
done
|
2014-03-13 04:21:14 +01:00
|
|
|
else ifeq ($(HAVE_RST2MAN),1)
|
2014-03-20 01:48:03 +01:00
|
|
|
$(prerst2man) $(srcdir)/doc $(DOCBUILDDIR)/man
|
2014-03-13 04:21:14 +01:00
|
|
|
else
|
2014-03-13 04:21:16 +01:00
|
|
|
@echo "Fatal: build dependency fail."
|
|
|
|
@false
|
2014-03-13 04:21:14 +01:00
|
|
|
endif
|
2014-03-05 14:34:10 +01:00
|
|
|
|
2014-03-13 04:21:16 +01:00
|
|
|
# Do not try to build or install man pages if a man page converter is
|
|
|
|
# not available.
|
|
|
|
ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)
|
|
|
|
build-man:
|
|
|
|
install-man:
|
|
|
|
@echo "No sphinx or rst2man, will not install man pages."
|
|
|
|
else
|
|
|
|
build-man: ${MAN_GZIP_FILES}
|
2014-03-05 14:34:10 +01:00
|
|
|
install-man: ${MAN_GZIP_FILES}
|
|
|
|
mkdir -p "$(DESTDIR)$(mandir)/man1"
|
|
|
|
mkdir -p "$(DESTDIR)$(mandir)/man5"
|
|
|
|
mkdir -p "$(DESTDIR)$(mandir)/man7"
|
2014-03-13 04:21:15 +01:00
|
|
|
install -m0644 $(DOCBUILDDIR)/man/man1/*.1.gz $(DESTDIR)/$(mandir)/man1
|
|
|
|
install -m0644 $(DOCBUILDDIR)/man/man5/*.5.gz $(DESTDIR)/$(mandir)/man5
|
|
|
|
install -m0644 $(DOCBUILDDIR)/man/man7/*.7.gz $(DESTDIR)/$(mandir)/man7
|
2014-03-05 14:34:10 +01:00
|
|
|
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
|
2014-03-13 04:21:16 +01:00
|
|
|
endif
|
2014-03-05 14:34:10 +01:00
|
|
|
|
|
|
|
$(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py
|
2014-03-20 01:48:03 +01:00
|
|
|
$(mkdocdeps) $(srcdir)/doc $(DOCBUILDDIR) $@
|
2014-03-05 14:34:10 +01:00
|
|
|
|
2014-03-13 04:21:14 +01:00
|
|
|
CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk $(dir)/man.stamp
|
|
|
|
CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES)
|