--- /dev/null
+Return-Path: <wking@tremily.us>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 1C251431FC3\r
+ for <notmuch@notmuchmail.org>; Sat, 12 Jul 2014 20:11:37 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id loM2W6VKVRn8 for <notmuch@notmuchmail.org>;\r
+ Sat, 12 Jul 2014 20:11:29 -0700 (PDT)\r
+Received: from qmta13.emeryville.ca.mail.comcast.net\r
+ (qmta13.emeryville.ca.mail.comcast.net [76.96.27.243])\r
+ by olra.theworths.org (Postfix) with ESMTP id 8BF22431FBD\r
+ for <notmuch@notmuchmail.org>; Sat, 12 Jul 2014 20:11:29 -0700 (PDT)\r
+Received: from omta13.emeryville.ca.mail.comcast.net ([76.96.30.52])\r
+ by qmta13.emeryville.ca.mail.comcast.net with comcast\r
+ id Rf7B1o00217UAYkADfBVTx; Sun, 13 Jul 2014 03:11:29 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by omta13.emeryville.ca.mail.comcast.net with comcast\r
+ id RfBU1o001152l3L8ZfBUNL; Sun, 13 Jul 2014 03:11:28 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.150])\r
+ by odin.tremily.us (Postfix) with ESMTPS id C6A751286F07;\r
+ Sat, 12 Jul 2014 20:11:27 -0700 (PDT)\r
+Received: (nullmailer pid 31454 invoked by uid 1000);\r
+ Sun, 13 Jul 2014 03:10:44 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 4/5] doc: Consolidate Makefile targets around\r
+ {build|install}-{format}\r
+Date: Sat, 12 Jul 2014 20:10:36 -0700\r
+Message-Id:\r
+ <8f21be7fd9e04f2b0141d1b6d44b1273c2ec42ce.1405220724.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
+In-Reply-To: <cover.1405220724.git.wking@tremily.us>\r
+References: <cover.1405220724.git.wking@tremily.us>\r
+In-Reply-To: <cover.1405220724.git.wking@tremily.us>\r
+References: <cover.1405220724.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20140121; t=1405221089;\r
+ bh=ehsgb++EpTqdn5+NMx3mocWuwLSYPIEFRoXN3D75XOo=;\r
+ h=Received:Received:Received:Received:From:To:Subject:Date:\r
+ Message-Id;\r
+ b=B/OWTb7iU/Vi+TKUfzQ1I3U81QqXey/qMh9pMYMI2scFa/wxDE7SFC0UfZN0TU2mR\r
+ M01D5FZcgyhTB+LJ+2aPEqrkP5lkWB8IKlApUdkI9nLOA4+qFuFKhLIqND59U2nq5S\r
+ mI/Vzz81baWbKQwaSBhpEdN9/ru2rbCJrwaZl8sKx6oLLHmTw3hUlOotg7e1NI/DxF\r
+ 1J+TQ/jst5Wou0E2DBbyBr4yHE0LmwP27GbrNTF3tueAyJDy2Oz1hAzOtEgYhe05qY\r
+ x3z/ww+mddxvX+sF03NyUeUhbW/lXZ0vHLYb6ZW0x0rG7a0cLXFpXd+SMjR57FGyMK\r
+ Sc/sggBVEQw7A==\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 13 Jul 2014 03:11:37 -0000\r
+\r
+The rst2man target was removed in 9d9a700 (doc: build man pages at\r
+build time; introduce HAVE_SPHINX, HAVE_RST2MAN, 2014-03-13), but a\r
+reference in the install docs slipped through. While I was removing\r
+that reference, I also:\r
+\r
+* Converted doc/INSTALL to reStructuredText, so I can link to Sphinx\r
+ and Docutils directly. Not everyone has access to Debian's\r
+ python-docutils, so it's better to be genric here.\r
+* Converted from an unordered list to paragraphs, because I think it\r
+ flows better.\r
+* Dropped the rst2man no-automatic-install caveat. I don't think this\r
+ applies to the current code, although I haven't tried to track down\r
+ a commit that adds the automatic-install support. Anyhow,\r
+\r
+ $ make HAVE_SPHINX=0 HAVE_RST2MAN=1 RST2MAN=rst2man.py DESTDIR=/tmp/ install-man\r
+\r
+ works for me.\r
+* Restructured the Makefile to use build- and install- prefixes\r
+ consistently, regardless of Sphinx/rst2x backend.\r
+* Instead of disabling the build-man and install-man targets if\r
+ HAVE_SPHINX and HAVE_RST2MAN are both empty, just pull build-man and\r
+ install-man out of the default build tree. That way:\r
+\r
+ $ make HAVE_SPHINX=0 HAVE_RST2MAN=0 build-man\r
+\r
+ will fail like it should, instead of successfully doing nothing. If\r
+ packagers *do* want to force building the docs, despite any config\r
+ settings, you can override the BUILD_MAN and INSTALL_MAN variables:\r
+\r
+ $ make BUILD_MAN=build-man all\r
+---\r
+ Makefile.local | 14 ++++++++++++--\r
+ doc/INSTALL | 44 ++++++++++++++++++++++++++++++--------------\r
+ doc/Makefile.local | 42 ++++++++++++++++++++++++------------------\r
+ 3 files changed, 66 insertions(+), 34 deletions(-)\r
+\r
+diff --git a/Makefile.local b/Makefile.local\r
+index fa07d81..83984fd 100644\r
+--- a/Makefile.local\r
++++ b/Makefile.local\r
+@@ -43,6 +43,15 @@ GPG_FILE=$(SHA1_FILE).asc\r
+ \r
+ PV_FILE=bindings/python/notmuch/version.py\r
+ \r
++# Disable docs if we don't have the builders\r
++ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)\r
++BUILD_MAN =\r
++INSTALL_MAN =\r
++else\r
++BUILD_MAN = build-man\r
++INSTALL_MAN = install-man\r
++endif\r
++\r
+ # Smash together user's values with our extra values\r
+ FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CPPFLAGS) $(CFLAGS) $(WARN_CFLAGS) $(extra_cflags) $(CONFIGURE_CFLAGS)\r
+ FINAL_CXXFLAGS = $(CPPFLAGS) $(CXXFLAGS) $(WARN_CXXFLAGS) $(extra_cflags) $(extra_cxxflags) $(CONFIGURE_CXXFLAGS)\r
+@@ -58,7 +67,7 @@ endif\r
+ FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)\r
+ \r
+ .PHONY: all\r
+-all: notmuch notmuch-shared build-man\r
++all: notmuch notmuch-shared $(BUILD_MAN)\r
+ ifeq ($(MAKECMDGOALS),)\r
+ ifeq ($(shell cat .first-build-message 2>/dev/null),)\r
+ @NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all\r
+@@ -299,7 +308,8 @@ notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)\r
+ $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@\r
+ \r
+ .PHONY: install\r
+-install: all install-man\r
++\r
++install: all $(INSTALL_MAN)\r
+ mkdir -p "$(DESTDIR)$(prefix)/bin/"\r
+ install notmuch-shared "$(DESTDIR)$(prefix)/bin/notmuch"\r
+ ifeq ($(MAKECMDGOALS), install)\r
+diff --git a/doc/INSTALL b/doc/INSTALL\r
+index e37c2b9..8352f7b 100644\r
+--- a/doc/INSTALL\r
++++ b/doc/INSTALL\r
+@@ -1,24 +1,40 @@\r
++.. -*- rst -*-\r
++\r
+ This file contains some more detailed information about building and\r
+ installing the documentation.\r
+ \r
+-Building with sphinx.\r
+----------------------\r
++Building with Sphinx\r
++--------------------\r
+ \r
+-- You need sphinx at least version 1.0.\r
++With Sphinx_ version 1.0 or greater, you can build HTML, man, and info\r
++versions of the documentation with::\r
+ \r
+-- You can build build and install man pages with 'make install-man'\r
++ make build-{html|info|man}\r
+ \r
+-- You can build man, info, html, and pdf versions of the docs\r
+- (currently only the man pages) with\r
++You can build and install the documentation with::\r
+ \r
+- 'make install-{man|info|html|pdf}'\r
++ make install-{info|man}\r
+ \r
+-Building the man pages\r
++Building with Docutils\r
+ ----------------------\r
+ \r
+-- You can build the man pages with rst2man (from python-docutils) with\r
+- 'make rst2man'.\r
+-\r
+-- Currently there is no support to automagically install the resulting\r
+- nroff files, but it should work to modify the target install-man\r
+- in doc/Makefile.local.\r
++If you don't have Sphinx installed, you can use Docutils_ with the\r
++same targets outlined above for Sphinx. The Docutils converters\r
++(rst2man, rst2html, etc.) are used instead of Sphinx. Only the man\r
++targets are currently supported.\r
++\r
++Configuring the builder\r
++-----------------------\r
++\r
++The builder (Sphinx or rst2man) used for compilation is chosen based\r
++on variables set in ``Makefile.config`` by the ``configure`` script.\r
++If ``HAVE_SPHINX`` is 1, ``SPHINXBUILD`` (``sphinx-build`` by default)\r
++is used to build the documentation. If ``HAVE_SPHINX`` is not 1, and\r
++``HAVE_RST2MAN`` is 1, ``RST2MAN`` is used to build the documentation.\r
++The ``configure`` script autodetects ``rst2man`` or ``rst2man.py`` in\r
++your ``PATH`` and sets an appropriate ``RST2MAN`` in\r
++``Makefile.config``. If neither ``HAVE_SPHINX`` nor ``HAVE_RST2MAN``\r
++is 1, attempting to build the documentation will fail with an error.\r
++\r
++.. _Sphinx: http://sphinx-doc.org/\r
++.. _Docutils: http://docutils.sourceforge.net/\r
+diff --git a/doc/Makefile.local b/doc/Makefile.local\r
+index 045f823..9b99c19 100644\r
+--- a/doc/Makefile.local\r
++++ b/doc/Makefile.local\r
+@@ -13,22 +13,35 @@ mkdocdeps := python $(srcdir)/$(dir)/mkdocdeps.py\r
+ # Internal variables.\r
+ ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(srcdir)/$(dir)\r
+ \r
+-.PHONY: sphinx-html sphinx-texinfo sphinx-info\r
++.PHONY: build-html build-info build-texinfo build-man\r
+ \r
+-.PHONY: install-man build-man\r
++.PHONY: install-info install-man\r
+ \r
+ %.gz: %\r
+ rm -f $@ && gzip --stdout $^ > $@\r
+ \r
+-sphinx-html:\r
++build-html:\r
++ifeq ($(HAVE_SPHINX),1)\r
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html\r
++else\r
++ @echo "fatal: no Sphinx, cannot build HTML docs"\r
++ @false\r
++endif\r
+ \r
+-sphinx-texinfo:\r
++build-texinfo:\r
++ifeq ($(HAVE_SPHINX),1)\r
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo\r
++else\r
++ @echo "fatal: no Sphinx or rst2texinfo, cannot build texinfo docs"\r
++ @false\r
++endif\r
+ \r
+-sphinx-info: sphinx-texinfo\r
++build-info: build-texinfo\r
+ make -C $(DOCBUILDDIR)/texinfo info\r
+ \r
++install-info: build-info\r
++ make -C $(DOCBUILDDIR)/texinfo install-info\r
++\r
+ -include $(dir)/docdeps.mk\r
+ \r
+ MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})\r
+@@ -51,20 +64,14 @@ ifeq ($(HAVE_SPHINX),1)\r
+ else ifeq ($(HAVE_RST2MAN),1)\r
+ $(rstman2any) --converter "$(RST2MAN)" --input $(srcdir)/doc --output $(DOCBUILDDIR)/man\r
+ else\r
+- @echo "Fatal: build dependency fail."\r
++ @echo "fatal: no Sphinx or rst2man, cannot build man pages"\r
+ @false\r
+ endif\r
+- touch ${MAN_ROFF_FILES} $@\r
+-\r
+-# Do not try to build or install man pages if a man page converter is\r
+-# not available.\r
+-ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)\r
+-build-man:\r
+-install-man:\r
+- @echo "No sphinx or rst2man, will not install man pages."\r
+-else\r
+-build-man: ${MAN_GZIP_FILES}\r
+-install-man: ${MAN_GZIP_FILES}\r
++ touch "$@"\r
++\r
++build-man: $(MAN_ROFF_FILES)\r
++\r
++install-man: $(MAN_GZIP_FILES)\r
+ mkdir -p "$(DESTDIR)$(mandir)/man1"\r
+ mkdir -p "$(DESTDIR)$(mandir)/man5"\r
+ mkdir -p "$(DESTDIR)$(mandir)/man7"\r
+@@ -72,7 +79,6 @@ install-man: ${MAN_GZIP_FILES}\r
+ install -m0644 $(DOCBUILDDIR)/man/man5/*.5.gz $(DESTDIR)/$(mandir)/man5\r
+ install -m0644 $(DOCBUILDDIR)/man/man7/*.7.gz $(DESTDIR)/$(mandir)/man7\r
+ cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz\r
+-endif\r
+ \r
+ $(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py\r
+ $(mkdocdeps) $(srcdir)/doc $(DOCBUILDDIR) $@\r
+-- \r
+1.9.1.353.gc66d89d\r
+\r