unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [Patch v3 1/3] doc: build and install doxygen api docs
Date: Sun,  6 Jul 2014 11:46:32 -0300	[thread overview]
Message-ID: <1404657994-30628-2-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1404657994-30628-1-git-send-email-david@tethera.net>

In order to support out of tree builds, generate `doc/config.dox` from
configure.

In order to avoid hardcoding version in doxygen.cfg, generate
doc/version.dox at build time.
---
 configure          | 18 ++++++++++++++++++
 doc/Makefile.local | 26 ++++++++++++++++++++++++--
 doc/doxygen.cfg    |  6 +++---
 3 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 9514d4d..ec3a895 100755
--- a/configure
+++ b/configure
@@ -417,6 +417,15 @@ else
     have_emacs=0
 fi
 
+printf "Checking if doxygen is available... "
+if doxygen -v > /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"
@@ -725,6 +734,12 @@ commands to compile and install notmuch:
 
 EOF
 
+# construct the Doxygen file list
+cat > doc/config.dox <<EOF
+# This doxgen config snippet generated by ../configure
+INPUT=${srcdir}/lib/notmuch.h
+EOF
+
 # construct the Makefile.config
 cat > Makefile.config <<EOF
 # This Makefile.config was automatically generated by the ./configure
@@ -829,6 +844,9 @@ HAVE_SPHINX=${have_sphinx}
 # 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
 
diff --git a/doc/Makefile.local b/doc/Makefile.local
index bbd4610..618b840 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -12,10 +12,12 @@ mkdocdeps := python $(srcdir)/$(dir)/mkdocdeps.py
 
 # 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: install-man build-man
+.PHONY: install-man build-man apidocs install-apidocs
 
 %.gz: %
 	rm -f $@ && gzip --stdout $^ > $@
@@ -56,6 +58,23 @@ else
 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)/version.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)
@@ -74,8 +93,11 @@ install-man: ${MAN_GZIP_FILES}
 	cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
 endif
 
+$(dir)/version.dox: version.stamp
+	echo "PROJECT_NAME = \"Notmuch $(VERSION)\"" > $@
+
 $(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)/version.dox $(dir)/config.dox
diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
index bfbfcab..68e8969 100644
--- a/doc/doxygen.cfg
+++ b/doc/doxygen.cfg
@@ -4,11 +4,11 @@
 # Project related configuration options
 #---------------------------------------------------------------------------
 DOXYFILE_ENCODING      = UTF-8
-PROJECT_NAME           = "Notmuch 0.18"
+@INCLUDE	       =  "doc/version.dox"
 PROJECT_NUMBER         =
 PROJECT_BRIEF          =
 PROJECT_LOGO           =
-OUTPUT_DIRECTORY       =
+OUTPUT_DIRECTORY       = doc/_build
 CREATE_SUBDIRS         = NO
 OUTPUT_LANGUAGE        = English
 BRIEF_MEMBER_DESC      = YES
@@ -96,7 +96,7 @@ WARN_LOGFILE           =
 #---------------------------------------------------------------------------
 # configuration options related to the input files
 #---------------------------------------------------------------------------
-INPUT                  = lib/notmuch.h
+@INCLUDE	       = doc/config.dox
 INPUT_ENCODING         = UTF-8
 FILE_PATTERNS          =
 RECURSIVE              = NO
-- 
2.0.0.rc2

  reply	other threads:[~2014-07-06 17:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-06 14:46 build and install api docs with doxygen David Bremner
2014-07-06 14:46 ` David Bremner [this message]
2014-07-06 14:46 ` [Patch v3 2/3] doc: quiet doxygen warnings David Bremner
2014-07-06 14:46 ` [Patch v3 3/3] doc: postprocess notmuch.3 David Bremner
2014-07-08 23:57   ` doxygen api docs David Bremner
2014-07-08 23:57     ` [Patch v4 1/3] doc: build and install " David Bremner
2014-07-09 20:22       ` Tomi Ollila
2014-07-08 23:57     ` [Patch v4 2/3] doc: quiet doxygen warnings David Bremner
2014-07-08 23:57     ` [Patch v4 3/3] doc: postprocess notmuch.3 David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404657994-30628-2-git-send-email-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).