mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
doc: build man pages at build time; introduce HAVE_SPHINX, HAVE_RST2MAN
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.
This commit is contained in:
parent
3fed6736a7
commit
9d9a700f1d
3 changed files with 22 additions and 14 deletions
|
@ -53,7 +53,7 @@ endif
|
||||||
FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)
|
FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: notmuch notmuch-shared
|
all: notmuch notmuch-shared build-man
|
||||||
ifeq ($(MAKECMDGOALS),)
|
ifeq ($(MAKECMDGOALS),)
|
||||||
ifeq ($(shell cat .first-build-message 2>/dev/null),)
|
ifeq ($(shell cat .first-build-message 2>/dev/null),)
|
||||||
@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
|
@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
|
||||||
|
|
|
@ -13,10 +13,9 @@ mkdocdeps := python $(dir)/mkdocdeps.py
|
||||||
# Internal variables.
|
# Internal variables.
|
||||||
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)
|
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)
|
||||||
|
|
||||||
.PHONY: sphinx-html sphinx-man sphinx-texinfo sphinx-info
|
.PHONY: sphinx-html sphinx-texinfo sphinx-info
|
||||||
.PHONY: rst2man
|
|
||||||
|
|
||||||
.PHONY: install-man
|
.PHONY: install-man build-man
|
||||||
|
|
||||||
%.gz: %
|
%.gz: %
|
||||||
rm -f $@ && gzip --stdout $^ > $@
|
rm -f $@ && gzip --stdout $^ > $@
|
||||||
|
@ -24,24 +23,30 @@ ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)
|
||||||
sphinx-html:
|
sphinx-html:
|
||||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html
|
||||||
|
|
||||||
sphinx-man:
|
|
||||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
|
|
||||||
|
|
||||||
sphinx-texinfo:
|
sphinx-texinfo:
|
||||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo
|
||||||
|
|
||||||
sphinx-info: sphinx-texinfo
|
sphinx-info: sphinx-texinfo
|
||||||
make -C $(DOCBUILDDIR)/texinfo info
|
make -C $(DOCBUILDDIR)/texinfo info
|
||||||
|
|
||||||
# fallback target in case sphinx not installed
|
|
||||||
rst2man:
|
|
||||||
$(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man
|
|
||||||
|
|
||||||
-include $(dir)/docdeps.mk
|
-include $(dir)/docdeps.mk
|
||||||
|
|
||||||
MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
|
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}
|
install-man: ${MAN_GZIP_FILES}
|
||||||
mkdir -p "$(DESTDIR)$(mandir)/man1"
|
mkdir -p "$(DESTDIR)$(mandir)/man1"
|
||||||
|
@ -52,8 +57,8 @@ install-man: ${MAN_GZIP_FILES}
|
||||||
install -m0644 $(DOCBUILDDIR)/man/*.7.gz $(DESTDIR)/$(mandir)/man7
|
install -m0644 $(DOCBUILDDIR)/man/*.7.gz $(DESTDIR)/$(mandir)/man7
|
||||||
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
|
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
|
||||||
|
|
||||||
|
|
||||||
$(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py
|
$(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py
|
||||||
$(mkdocdeps) $< $(DOCBUILDDIR) $@
|
$(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)
|
||||||
|
|
|
@ -6,8 +6,11 @@ outfile = argv[3]
|
||||||
execfile(conffile)
|
execfile(conffile)
|
||||||
|
|
||||||
roff_files = []
|
roff_files = []
|
||||||
|
rst_files = []
|
||||||
out=open(outfile,'w')
|
out=open(outfile,'w')
|
||||||
for page in man_pages:
|
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])]
|
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_ROFF_FILES := ' + ' \\\n\t'.join(roff_files)+'\n')
|
||||||
|
out.write ('MAN_RST_FILES := ' + ' \\\n\t'.join(rst_files)+'\n')
|
||||||
|
|
Loading…
Reference in a new issue