2020-08-08 13:49:49 +02:00
|
|
|
# -*- makefile-gmake -*-
|
2014-01-28 17:12:37 +01:00
|
|
|
|
|
|
|
dir := doc
|
|
|
|
|
|
|
|
# You can set these variables from the command line.
|
2014-03-20 01:48:03 +01:00
|
|
|
SPHINXOPTS := -q
|
2021-10-29 16:54:59 +02:00
|
|
|
SPHINXBUILD = env LD_LIBRARY_PATH=${NOTMUCH_BUILDDIR}/lib sphinx-build
|
2014-01-28 17:12:37 +01:00
|
|
|
DOCBUILDDIR := $(dir)/_build
|
|
|
|
|
|
|
|
# Internal variables.
|
2019-06-01 04:24:52 +02:00
|
|
|
ALLSPHINXOPTS := $(SPHINXOPTS) $(srcdir)/$(dir)
|
2014-07-01 18:40:33 +02:00
|
|
|
APIMAN := $(DOCBUILDDIR)/man/man3/notmuch.3
|
|
|
|
DOXYFILE := $(srcdir)/$(dir)/doxygen.cfg
|
2014-01-28 17:12:37 +01:00
|
|
|
|
2016-11-05 21:18:17 +01:00
|
|
|
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)
|
2019-04-21 18:53:03 +02:00
|
|
|
ALL_RST_FILES := $(MAN_RST_FILES) $(srcdir)/doc/notmuch-emacs.rst
|
2016-11-05 21:18:17 +01:00
|
|
|
|
2022-07-01 03:14:20 +02:00
|
|
|
COPY_ROFF1 := $(patsubst %,$(DOCBUILDDIR)/man/man1/%.1,nmbug notmuch-setup)
|
2016-11-05 21:18:17 +01:00
|
|
|
MAN1_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN1_RST:.rst=.1))
|
2022-07-01 03:14:20 +02:00
|
|
|
MAN1_ROFF := $(MAN1_ROFF) $(COPY_ROFF1)
|
2016-11-05 21:18:17 +01:00
|
|
|
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})
|
|
|
|
|
2018-05-21 22:08:51 +02:00
|
|
|
MAN1_TEXI := $(patsubst $(srcdir)/doc/man1/%.rst,$(DOCBUILDDIR)/texinfo/%.texi,$(MAN1_RST))
|
|
|
|
MAN5_TEXI := $(patsubst $(srcdir)/doc/man5/%.rst,$(DOCBUILDDIR)/texinfo/%.texi,$(MAN5_RST))
|
|
|
|
MAN7_TEXI := $(patsubst $(srcdir)/doc/man7/%.rst,$(DOCBUILDDIR)/texinfo/%.texi,$(MAN7_RST))
|
2019-06-10 12:11:50 +02:00
|
|
|
INFO_TEXI_FILES := $(MAN1_TEXI) $(MAN5_TEXI) $(MAN7_TEXI)
|
2019-06-12 02:12:38 +02:00
|
|
|
ifeq ($(WITH_EMACS),1)
|
|
|
|
INFO_TEXI_FILES += $(DOCBUILDDIR)/texinfo/notmuch-emacs.texi
|
2019-06-10 12:11:50 +02:00
|
|
|
endif
|
|
|
|
|
2022-07-01 03:14:20 +02:00
|
|
|
COPY_INFO1 := $(patsubst $(DOCBUILDDIR)/man/man1/%.1,$(DOCBUILDDIR)/texinfo/%.info,$(COPY_ROFF1))
|
|
|
|
INFO_INFO_FILES := $(INFO_TEXI_FILES:.texi=.info) $(COPY_INFO1)
|
2018-05-21 22:08:51 +02:00
|
|
|
|
2021-12-05 00:47:50 +01:00
|
|
|
.PHONY: sphinx-html sphinx-texinfo sphinx-info
|
2014-01-28 17:12:37 +01:00
|
|
|
|
2014-07-01 18:40:33 +02:00
|
|
|
.PHONY: install-man build-man apidocs install-apidocs
|
2014-03-05 14:34:10 +01:00
|
|
|
|
|
|
|
%.gz: %
|
2020-07-11 18:04:35 +02:00
|
|
|
rm -f $@ && gzip --no-name --stdout $^ > $@
|
2014-03-05 14:34:10 +01:00
|
|
|
|
2018-06-14 02:32:40 +02:00
|
|
|
ifeq ($(WITH_EMACS),1)
|
2020-12-10 02:55:38 +01:00
|
|
|
$(DOCBUILDDIR)/.roff.stamp $(DOCBUILDDIR)/.html.stamp $(DOCBUILDDIR)/.texi.stamp : docstring.stamp
|
2018-06-14 02:32:40 +02:00
|
|
|
endif
|
|
|
|
|
2021-10-29 16:54:59 +02:00
|
|
|
ifeq ($(HAVE_PYTHON3_CFFI),1)
|
2021-12-05 00:47:50 +01:00
|
|
|
DOC_PREREQS=bindings/python-cffi.stamp
|
|
|
|
else
|
|
|
|
DOC_PREREQS=
|
2021-10-29 16:54:59 +02:00
|
|
|
endif
|
|
|
|
|
2019-04-21 19:00:18 +02:00
|
|
|
sphinx-html: $(DOCBUILDDIR)/.html.stamp
|
|
|
|
|
2021-12-05 00:47:50 +01:00
|
|
|
$(DOCBUILDDIR)/.html.stamp: $(ALL_RST_FILES) $(DOC_PREREQS)
|
2019-06-01 04:24:52 +02:00
|
|
|
$(SPHINXBUILD) -b html -d $(DOCBUILDDIR)/html_doctrees $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html
|
2019-04-21 19:00:18 +02:00
|
|
|
touch $@
|
2014-01-28 17:12:37 +01:00
|
|
|
|
2019-04-21 18:53:03 +02:00
|
|
|
sphinx-texinfo: $(DOCBUILDDIR)/.texi.stamp
|
|
|
|
|
2021-12-05 00:47:50 +01:00
|
|
|
$(DOCBUILDDIR)/.texi.stamp: $(ALL_RST_FILES) $(DOC_PREREQS)
|
2019-06-01 04:24:52 +02:00
|
|
|
$(SPHINXBUILD) -b texinfo -d $(DOCBUILDDIR)/texinfo_doctrees $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo
|
2019-04-21 18:53:03 +02:00
|
|
|
touch $@
|
2014-01-28 17:12:37 +01:00
|
|
|
|
2021-12-05 00:47:51 +01:00
|
|
|
sphinx-info: $(DOCBUILDDIR)/.info.stamp
|
|
|
|
|
|
|
|
$(DOCBUILDDIR)/.info.stamp: $(DOCBUILDDIR)/.texi.stamp $(DOC_PREREQS)
|
2019-03-20 00:50:28 +01:00
|
|
|
$(MAKE) -C $(DOCBUILDDIR)/texinfo info
|
2021-12-05 00:47:51 +01:00
|
|
|
touch $@
|
2014-01-28 17:12:37 +01:00
|
|
|
|
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.
|
2014-04-17 22:34:57 +02:00
|
|
|
${MAN_ROFF_FILES}: $(DOCBUILDDIR)/.roff.stamp
|
|
|
|
|
|
|
|
# By using $(DOCBUILDDIR)/.roff.stamp instead of ${MAN_ROFF_FILES}, we
|
|
|
|
# convey to make that a single invocation of this recipe builds all
|
|
|
|
# of the roff files. This prevents parallel make from starting an
|
|
|
|
# instance of this recipe for each roff file.
|
|
|
|
$(DOCBUILDDIR)/.roff.stamp: ${MAN_RST_FILES}
|
2014-03-13 04:21:14 +01:00
|
|
|
ifeq ($(HAVE_SPHINX),1)
|
2019-06-01 04:24:52 +02:00
|
|
|
$(SPHINXBUILD) -b man -d $(DOCBUILDDIR)/man_doctrees $(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
|
2014-03-13 04:21:16 +01:00
|
|
|
@echo "Fatal: build dependency fail."
|
|
|
|
@false
|
2014-03-13 04:21:14 +01:00
|
|
|
endif
|
2016-11-05 21:18:16 +01:00
|
|
|
touch $@
|
2014-03-05 14:34:10 +01:00
|
|
|
|
2014-07-01 18:40:33 +02:00
|
|
|
install-man: install-apidocs
|
|
|
|
|
|
|
|
ifeq ($(HAVE_DOXYGEN),1)
|
|
|
|
MAN_GZIP_FILES += ${APIMAN}.gz
|
|
|
|
apidocs: $(APIMAN)
|
2015-01-25 15:04:51 +01:00
|
|
|
install-apidocs: ${APIMAN}.gz
|
2014-07-01 18:40:33 +02:00
|
|
|
mkdir -p "$(DESTDIR)$(mandir)/man3"
|
2016-11-05 21:18:18 +01:00
|
|
|
install -m0644 $(filter %.3.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man3
|
2014-07-01 18:40:33 +02:00
|
|
|
|
|
|
|
$(APIMAN): $(dir)/config.dox $(srcdir)/$(dir)/doxygen.cfg $(srcdir)/lib/notmuch.h
|
|
|
|
mkdir -p $(DOCBUILDDIR)/man/man3
|
|
|
|
doxygen $(DOXYFILE)
|
2014-09-01 20:44:59 +02:00
|
|
|
rm -f $(DOCBUILDDIR)/man/man3/_*.3
|
2014-07-01 21:13:03 +02:00
|
|
|
perl -pi -e 's/^[.]RI "\\fI/.RI "\\fP/' $(APIMAN)
|
2014-07-01 18:40:33 +02:00
|
|
|
else
|
|
|
|
apidocs:
|
|
|
|
install-apidocs:
|
|
|
|
endif
|
|
|
|
|
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.
|
2015-01-18 17:55:10 +01:00
|
|
|
ifeq ($(HAVE_SPHINX),0)
|
2014-03-13 04:21:16 +01:00
|
|
|
build-man:
|
|
|
|
install-man:
|
2015-01-18 17:55:10 +01:00
|
|
|
@echo "No sphinx, will not install man pages."
|
2014-03-13 04:21:16 +01:00
|
|
|
else
|
2021-12-24 17:20:31 +01:00
|
|
|
|
|
|
|
# it should be safe to depend on the stamp file, because it is created
|
|
|
|
# after all roff files are moved into place.
|
|
|
|
${MAN_GZIP_FILES}: ${DOCBUILDDIR}/.roff.stamp
|
|
|
|
|
2014-03-13 04:21:16 +01:00
|
|
|
build-man: ${MAN_GZIP_FILES}
|
2014-03-05 14:34:10 +01:00
|
|
|
install-man: ${MAN_GZIP_FILES}
|
2018-01-31 21:50:45 +01:00
|
|
|
mkdir -m0755 -p "$(DESTDIR)$(mandir)/man1"
|
|
|
|
mkdir -m0755 -p "$(DESTDIR)$(mandir)/man5"
|
|
|
|
mkdir -m0755 -p "$(DESTDIR)$(mandir)/man7"
|
2016-11-05 21:18:18 +01:00
|
|
|
install -m0644 $(filter %.1.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man1
|
|
|
|
install -m0644 $(filter %.5.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man5
|
|
|
|
install -m0644 $(filter %.7.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man7
|
2014-03-13 04:21:16 +01:00
|
|
|
endif
|
2014-03-05 14:34:10 +01:00
|
|
|
|
2018-05-21 22:08:51 +02:00
|
|
|
ifneq ($(HAVE_SPHINX)$(HAVE_MAKEINFO),11)
|
|
|
|
build-info:
|
|
|
|
@echo "Missing sphinx or makeinfo, not building info pages"
|
|
|
|
else
|
2021-12-05 00:47:51 +01:00
|
|
|
build-info: $(DOCBUILDDIR)/.info.stamp
|
2018-05-21 22:08:51 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(HAVE_SPHINX)$(HAVE_MAKEINFO)$(HAVE_INSTALL_INFO),111)
|
|
|
|
install-info:
|
|
|
|
@echo "Missing prerequisites, not installing info pages"
|
|
|
|
else
|
|
|
|
install-info: build-info
|
|
|
|
mkdir -m0755 -p "$(DESTDIR)$(infodir)"
|
|
|
|
install -m0644 $(INFO_INFO_FILES) $(DESTDIR)$(infodir)
|
|
|
|
for file in $(INFO_INFO_FILES); do install-info $$file $(DESTDIR)$(infodir)/dir; done
|
|
|
|
endif
|
|
|
|
|
2014-07-01 18:40:33 +02:00
|
|
|
$(dir)/config.dox: version.stamp
|
|
|
|
echo "PROJECT_NAME = \"Notmuch $(VERSION)\"" > $@
|
|
|
|
echo "INPUT=${srcdir}/lib/notmuch.h" >> $@
|
|
|
|
|
2019-04-21 18:53:03 +02:00
|
|
|
CLEAN := $(CLEAN) $(DOCBUILDDIR) $(DOCBUILDDIR)/.roff.stamp $(DOCBUILDDIR)/.texi.stamp
|
2021-12-05 00:47:51 +01:00
|
|
|
CLEAN := $(CLEAN) $(DOCBUILDDIR)/.html.stamp $(DOCBUILDDIR)/.info.stamp
|
2014-07-01 18:40:33 +02:00
|
|
|
CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES) $(dir)/conf.pyc $(dir)/config.dox
|
2023-09-11 01:13:13 +02:00
|
|
|
|
|
|
|
CLEAN := $(CLEAN) $(dir)/__pycache__
|