In order to support out of tree builds and avoid hardcoding version
number, generate `doc/config.dox` from configure.
+printf "Checking if doxygen is available... "
+if command -v doxygen > /dev/null 2>&1; then
+ printf "Yes.\n"
+ have_doxygen=1
+else
+ printf "No (so will not install api docs)\n"
+ have_doxygen=0
+fi
+
printf "Checking if sphinx is available and supports nroff output... "
if hash sphinx-build > /dev/null 2>&1 && python -m sphinx.writers.manpage > /dev/null 2>&1 ; then
printf "Yes.\n"
printf "Checking if sphinx is available and supports nroff output... "
if hash sphinx-build > /dev/null 2>&1 && python -m sphinx.writers.manpage > /dev/null 2>&1 ; then
printf "Yes.\n"
# Whether there's a rst2man binary available for building documentation
HAVE_RST2MAN=${have_rst2man}
# Whether there's a rst2man binary available for building documentation
HAVE_RST2MAN=${have_rst2man}
+# Whether there's a doxygen binary available for building api documentation
+HAVE_DOXYGEN=${have_doxygen}
+
# The directory to which desktop files should be installed
desktop_dir = \$(prefix)/share/applications
# The directory to which desktop files should be installed
desktop_dir = \$(prefix)/share/applications
# Internal variables.
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(srcdir)/$(dir)
# Internal variables.
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(srcdir)/$(dir)
+APIMAN := $(DOCBUILDDIR)/man/man3/notmuch.3
+DOXYFILE := $(srcdir)/$(dir)/doxygen.cfg
.PHONY: sphinx-html sphinx-texinfo sphinx-info
.PHONY: sphinx-html sphinx-texinfo sphinx-info
-.PHONY: install-man build-man
+.PHONY: install-man build-man apidocs install-apidocs
%.gz: %
rm -f $@ && gzip --stdout $^ > $@
%.gz: %
rm -f $@ && gzip --stdout $^ > $@
endif
touch ${MAN_ROFF_FILES} $@
endif
touch ${MAN_ROFF_FILES} $@
+install-man: install-apidocs
+
+ifeq ($(HAVE_DOXYGEN),1)
+MAN_GZIP_FILES += ${APIMAN}.gz
+apidocs: $(APIMAN)
+install-apidocs: apidocs
+ mkdir -p "$(DESTDIR)$(mandir)/man3"
+ install -m0644 $(DOCBUILDDIR)/man/man3/*.3.gz $(DESTDIR)/$(mandir)/man3
+
+$(APIMAN): $(dir)/config.dox $(srcdir)/$(dir)/doxygen.cfg $(srcdir)/lib/notmuch.h
+ mkdir -p $(DOCBUILDDIR)/man/man3
+ doxygen $(DOXYFILE)
+else
+apidocs:
+install-apidocs:
+endif
+
# Do not try to build or install man pages if a man page converter is
# not available.
ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)
# Do not try to build or install man pages if a man page converter is
# not available.
ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
endif
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
endif
+$(dir)/config.dox: version.stamp
+ echo "PROJECT_NAME = \"Notmuch $(VERSION)\"" > $@
+ echo "INPUT=${srcdir}/lib/notmuch.h" >> $@
+
$(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py
$(mkdocdeps) $(srcdir)/doc $(DOCBUILDDIR) $@
CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk $(DOCBUILDDIR)/.roff.stamp
$(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py
$(mkdocdeps) $(srcdir)/doc $(DOCBUILDDIR) $@
CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk $(DOCBUILDDIR)/.roff.stamp
-CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES) $(dir)/conf.pyc
+CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES) $(dir)/conf.pyc $(dir)/config.dox
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
-PROJECT_NAME = "Notmuch 0.18"
+@INCLUDE = "doc/config.dox"
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
+OUTPUT_DIRECTORY = doc/_build
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO