5 # You can set these variables from the command line.
7 SPHINXBUILD = sphinx-build
8 DOCBUILDDIR := $(dir)/_build
11 ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(srcdir)/$(dir)
12 APIMAN := $(DOCBUILDDIR)/man/man3/notmuch.3
13 DOXYFILE := $(srcdir)/$(dir)/doxygen.cfg
15 MAN1_RST := $(wildcard $(srcdir)/doc/man1/*.rst)
16 MAN5_RST := $(wildcard $(srcdir)/doc/man5/*.rst)
17 MAN7_RST := $(wildcard $(srcdir)/doc/man7/*.rst)
18 MAN_RST_FILES := $(MAN1_RST) $(MAN5_RST) $(MAN7_RST)
20 MAN1_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN1_RST:.rst=.1))
21 MAN5_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN5_RST:.rst=.5))
22 MAN7_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN7_RST:.rst=.7))
23 MAN_ROFF_FILES := $(MAN1_ROFF) $(MAN5_ROFF) $(MAN7_ROFF)
25 MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
27 .PHONY: sphinx-html sphinx-texinfo sphinx-info
29 .PHONY: install-man build-man apidocs install-apidocs
32 rm -f $@ && gzip --stdout $^ > $@
35 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html
38 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo
40 sphinx-info: sphinx-texinfo
41 make -C $(DOCBUILDDIR)/texinfo info
43 # Use the man page converter that is available. We should never depend
44 # on MAN_ROFF_FILES if a converter is not available.
45 ${MAN_ROFF_FILES}: $(DOCBUILDDIR)/.roff.stamp
47 # By using $(DOCBUILDDIR)/.roff.stamp instead of ${MAN_ROFF_FILES}, we
48 # convey to make that a single invocation of this recipe builds all
49 # of the roff files. This prevents parallel make from starting an
50 # instance of this recipe for each roff file.
51 $(DOCBUILDDIR)/.roff.stamp: ${MAN_RST_FILES}
52 ifeq ($(HAVE_SPHINX),1)
53 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
54 for section in 1 5 7; do \
55 mkdir -p $(DOCBUILDDIR)/man/man$${section}; \
56 mv $(DOCBUILDDIR)/man/*.$${section} $(DOCBUILDDIR)/man/man$${section}; \
59 @echo "Fatal: build dependency fail."
64 install-man: install-apidocs
66 ifeq ($(HAVE_DOXYGEN),1)
67 MAN_GZIP_FILES += ${APIMAN}.gz
69 install-apidocs: ${APIMAN}.gz
70 mkdir -p "$(DESTDIR)$(mandir)/man3"
71 install -m0644 $(filter %.3.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man3
73 $(APIMAN): $(dir)/config.dox $(srcdir)/$(dir)/doxygen.cfg $(srcdir)/lib/notmuch.h
74 mkdir -p $(DOCBUILDDIR)/man/man3
76 rm -f $(DOCBUILDDIR)/man/man3/_*.3
77 perl -pi -e 's/^[.]RI "\\fI/.RI "\\fP/' $(APIMAN)
83 # Do not try to build or install man pages if a man page converter is
85 ifeq ($(HAVE_SPHINX),0)
88 @echo "No sphinx, will not install man pages."
90 build-man: ${MAN_GZIP_FILES}
91 install-man: ${MAN_GZIP_FILES}
92 mkdir -p "$(DESTDIR)$(mandir)/man1"
93 mkdir -p "$(DESTDIR)$(mandir)/man5"
94 mkdir -p "$(DESTDIR)$(mandir)/man7"
95 install -m0644 $(filter %.1.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man1
96 install -m0644 $(filter %.5.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man5
97 install -m0644 $(filter %.7.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man7
98 cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
101 $(dir)/config.dox: version.stamp
102 echo "PROJECT_NAME = \"Notmuch $(VERSION)\"" > $@
103 echo "INPUT=${srcdir}/lib/notmuch.h" >> $@
105 CLEAN := $(CLEAN) $(DOCBUILDDIR) $(DOCBUILDDIR)/.roff.stamp
106 CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES) $(dir)/conf.pyc $(dir)/config.dox