--- /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 40F41431FDF\r
+ for <notmuch@notmuchmail.org>; Sat, 10 May 2014 10:04:38 -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 YezVV1DonmUH for <notmuch@notmuchmail.org>;\r
+ Sat, 10 May 2014 10:04:32 -0700 (PDT)\r
+Received: from qmta12.westchester.pa.mail.comcast.net\r
+ (qmta12.westchester.pa.mail.comcast.net [76.96.59.227])\r
+ by olra.theworths.org (Postfix) with ESMTP id 449BC431FC4\r
+ for <notmuch@notmuchmail.org>; Sat, 10 May 2014 10:04:21 -0700 (PDT)\r
+Received: from omta07.westchester.pa.mail.comcast.net ([76.96.62.59])\r
+ by qmta12.westchester.pa.mail.comcast.net with comcast\r
+ id 0Ghz1o0011GhbT85CH4KKs; Sat, 10 May 2014 17:04:19 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by omta07.westchester.pa.mail.comcast.net with comcast\r
+ id 0H4H1o00L152l3L3TH4Jvl; Sat, 10 May 2014 17:04:19 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+ by odin.tremily.us (Postfix) with ESMTPS id B1AC511969AB;\r
+ Sat, 10 May 2014 10:04:17 -0700 (PDT)\r
+Received: (nullmailer pid 24535 invoked by uid 1000);\r
+ Sat, 10 May 2014 17:03:44 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 4/5] doc: Consolidate Makefile targets around\r
+ {build|install}-{format}\r
+Date: Sat, 10 May 2014 10:03:35 -0700\r
+Message-Id:\r
+ <4fb5447805a8d5bb8da74c0196f12ac4ffaf4394.1399740604.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
+In-Reply-To: <cover.1399740604.git.wking@tremily.us>\r
+References: <cover.1399740604.git.wking@tremily.us>\r
+In-Reply-To: <cover.1399740604.git.wking@tremily.us>\r
+References: <cover.1399740604.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20140121; t=1399741459;\r
+ bh=oDNX00yjXoSIulFPjlLo2PE9aYbMjg4skc5+Cu+CFXg=;\r
+ h=Received:Received:Received:Received:From:To:Subject:Date:\r
+ Message-Id;\r
+ b=Nul4zX+Mnr1FSJur2Iz3TQiL3JKP9QoQJzWK3jbnh1egc/gAbrmoKr2FIh9QO/7C3\r
+ 55cS2bH9c23QUv4ynhu0qxlJRPc7rDF6s6NdU4TIlbBrE4MRIobEhCOaFX/swD0aQZ\r
+ enGnLmDYhVdjgAZpppKwuWe/IoXf8j2iyUXeBO1TQSgjScWb4OQ14XKYFz2AE1EqQr\r
+ TqTk74GHi1A9YqF+z6R9Y3FPSbXDKIy9tTXHU95QsKgIpWIWaCX9LvbYIC19ZdjoeY\r
+ XVkeQQ2GD07b/c5D9Etz28Qff2L1mb9p5C8jDe4TBo4X6CSQheZ7kT5+iI13/Ojj2G\r
+ VHx1Zd1C9C9LA==\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: Sat, 10 May 2014 17:04:38 -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 5fb526b..49aa6dd 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
+ $(prerst2x) "$(RST2MAN)" $(srcdir)/doc $(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