From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [Patch v3 1/4] doc: build man pages at build time; introduce HAVE_SPHINX, HAVE_RST2MAN
Date: Thu, 13 Mar 2014 00:21:14 -0300 [thread overview]
Message-ID: <1394680877-25572-2-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1394680877-25572-1-git-send-email-david@tethera.net>
This helps avoid build artifacts (namely, nroff and gzipped-nroff man
pages) owned by root.
The variables allow choosing which generator to use for the man page.
These will be hooked to configure in a following commit.
---
Makefile.local | 2 +-
doc/Makefile.local | 31 ++++++++++++++++++-------------
doc/mkdocdeps.py | 3 +++
3 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/Makefile.local b/Makefile.local
index 5f797ad..cb7b106 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -53,7 +53,7 @@ endif
FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)
.PHONY: all
-all: notmuch notmuch-shared
+all: notmuch notmuch-shared build-man
ifeq ($(MAKECMDGOALS),)
ifeq ($(shell cat .first-build-message 2>/dev/null),)
@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
diff --git a/doc/Makefile.local b/doc/Makefile.local
index fd64f70..23f4095 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -13,10 +13,9 @@ mkdocdeps := python $(dir)/mkdocdeps.py
# Internal variables.
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)
-.PHONY: sphinx-html sphinx-man sphinx-texinfo sphinx-info
-.PHONY: rst2man
+.PHONY: sphinx-html sphinx-texinfo sphinx-info
-.PHONY: install-man
+.PHONY: install-man build-man
%.gz: %
rm -f $@ && gzip --stdout $^ > $@
@@ -24,24 +23,30 @@ ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)
sphinx-html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html
-sphinx-man:
- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
-
sphinx-texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo
sphinx-info: sphinx-texinfo
make -C $(DOCBUILDDIR)/texinfo info
-# fallback target in case sphinx not installed
-rst2man:
- $(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man
-
-include $(dir)/docdeps.mk
MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
-${MAN_ROFF_FILES} : sphinx-man
+build-man: ${MAN_GZIP_FILES}
+
+${MAN_ROFF_FILES}: ${dir}/man.stamp
+
+$(dir)/man.stamp: ${MAN_RST_FILES}
+ifeq ($(HAVE_SPHINX),1)
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
+ touch $@
+else ifeq ($(HAVE_RST2MAN),1)
+ $(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man
+ touch $@
+else
+ @echo "No sphinx or rst2man, will not install man pages."
+endif
install-man: ${MAN_GZIP_FILES}
mkdir -p "$(DESTDIR)$(mandir)/man1"
@@ -52,8 +57,8 @@ install-man: ${MAN_GZIP_FILES}
install -m0644 $(DOCBUILDDIR)/man/*.7.gz $(DESTDIR)/$(mandir)/man7
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
-
$(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py
$(mkdocdeps) $< $(DOCBUILDDIR) $@
-CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk
+CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk $(dir)/man.stamp
+CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES)
diff --git a/doc/mkdocdeps.py b/doc/mkdocdeps.py
index 2f4a959..e61bea6 100644
--- a/doc/mkdocdeps.py
+++ b/doc/mkdocdeps.py
@@ -6,8 +6,11 @@ outfile = argv[3]
execfile(conffile)
roff_files = []
+rst_files = []
out=open(outfile,'w')
for page in man_pages:
+ rst_files = rst_files + ["doc/{0:s}.rst".format(page[0])]
roff_files = roff_files + ["{0:s}/man/{1:s}.{2:d}".format(builddir,page[1],page[4])]
out.write ('MAN_ROFF_FILES := ' + ' \\\n\t'.join(roff_files)+'\n')
+out.write ('MAN_RST_FILES := ' + ' \\\n\t'.join(rst_files)+'\n')
--
1.8.5.3
next prev parent reply other threads:[~2014-03-13 3:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 12:05 v2 man page build fixups David Bremner
2014-03-11 12:05 ` [Patch v2 1/3] doc: have prerst2man.py generate roff files all in one directory David Bremner
2014-03-11 12:05 ` [Patch v2 2/3] doc: build man pages at build time; introduce HAVE_SPHINX, HAVE_RST2MAN David Bremner
2014-03-11 12:05 ` [Patch v2 3/3] doc: configure detection of sphinx and rst2man David Bremner
2014-03-11 18:16 ` v2 man page build fixups Tomi Ollila
2014-03-13 3:21 ` David Bremner
2014-03-13 3:21 ` David Bremner [this message]
2014-03-13 3:21 ` [Patch v3 2/4] doc: build man pages into hierarchy, fix help test David Bremner
2014-03-13 3:21 ` [Patch v3 3/4] doc: configure detection of sphinx and rst2man David Bremner
2014-03-13 3:21 ` [Patch v3 4/4] doc: cosmetic fix for prerst2man.py David Bremner
2014-03-17 10:55 ` Tomi Ollila
2014-03-18 10:52 ` Re: 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=1394680877-25572-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).