mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-23 01:44:52 +01:00
cf8c689eab
Avoids the issue where umask can make man pages unreadable after installation. Relevant email on the mailing-list: <87h8rt30sy.fsf@fifthhorseman.net>
106 lines
3.5 KiB
Makefile
106 lines
3.5 KiB
Makefile
# -*- makefile -*-
|
|
|
|
dir := doc
|
|
|
|
# You can set these variables from the command line.
|
|
SPHINXOPTS := -q
|
|
SPHINXBUILD = sphinx-build
|
|
DOCBUILDDIR := $(dir)/_build
|
|
|
|
# Internal variables.
|
|
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(srcdir)/$(dir)
|
|
APIMAN := $(DOCBUILDDIR)/man/man3/notmuch.3
|
|
DOXYFILE := $(srcdir)/$(dir)/doxygen.cfg
|
|
|
|
MAN1_RST := $(wildcard $(srcdir)/doc/man1/*.rst)
|
|
MAN5_RST := $(wildcard $(srcdir)/doc/man5/*.rst)
|
|
MAN7_RST := $(wildcard $(srcdir)/doc/man7/*.rst)
|
|
MAN_RST_FILES := $(MAN1_RST) $(MAN5_RST) $(MAN7_RST)
|
|
|
|
MAN1_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN1_RST:.rst=.1))
|
|
MAN5_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN5_RST:.rst=.5))
|
|
MAN7_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN7_RST:.rst=.7))
|
|
MAN_ROFF_FILES := $(MAN1_ROFF) $(MAN5_ROFF) $(MAN7_ROFF)
|
|
|
|
MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
|
|
|
|
.PHONY: sphinx-html sphinx-texinfo sphinx-info
|
|
|
|
.PHONY: install-man build-man apidocs install-apidocs
|
|
|
|
%.gz: %
|
|
rm -f $@ && gzip --stdout $^ > $@
|
|
|
|
sphinx-html:
|
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html
|
|
|
|
sphinx-texinfo:
|
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo
|
|
|
|
sphinx-info: sphinx-texinfo
|
|
make -C $(DOCBUILDDIR)/texinfo info
|
|
|
|
# Use the man page converter that is available. We should never depend
|
|
# on MAN_ROFF_FILES if a converter is not available.
|
|
${MAN_ROFF_FILES}: $(DOCBUILDDIR)/.roff.stamp
|
|
|
|
# By using $(DOCBUILDDIR)/.roff.stamp instead of ${MAN_ROFF_FILES}, we
|
|
# convey to make that a single invocation of this recipe builds all
|
|
# of the roff files. This prevents parallel make from starting an
|
|
# instance of this recipe for each roff file.
|
|
$(DOCBUILDDIR)/.roff.stamp: ${MAN_RST_FILES}
|
|
ifeq ($(HAVE_SPHINX),1)
|
|
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
|
|
for section in 1 5 7; do \
|
|
mkdir -p $(DOCBUILDDIR)/man/man$${section}; \
|
|
mv $(DOCBUILDDIR)/man/*.$${section} $(DOCBUILDDIR)/man/man$${section}; \
|
|
done
|
|
else
|
|
@echo "Fatal: build dependency fail."
|
|
@false
|
|
endif
|
|
touch $@
|
|
|
|
install-man: install-apidocs
|
|
|
|
ifeq ($(HAVE_DOXYGEN),1)
|
|
MAN_GZIP_FILES += ${APIMAN}.gz
|
|
apidocs: $(APIMAN)
|
|
install-apidocs: ${APIMAN}.gz
|
|
mkdir -p "$(DESTDIR)$(mandir)/man3"
|
|
install -m0644 $(filter %.3.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man3
|
|
|
|
$(APIMAN): $(dir)/config.dox $(srcdir)/$(dir)/doxygen.cfg $(srcdir)/lib/notmuch.h
|
|
mkdir -p $(DOCBUILDDIR)/man/man3
|
|
doxygen $(DOXYFILE)
|
|
rm -f $(DOCBUILDDIR)/man/man3/_*.3
|
|
perl -pi -e 's/^[.]RI "\\fI/.RI "\\fP/' $(APIMAN)
|
|
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),0)
|
|
build-man:
|
|
install-man:
|
|
@echo "No sphinx, will not install man pages."
|
|
else
|
|
build-man: ${MAN_GZIP_FILES}
|
|
install-man: ${MAN_GZIP_FILES}
|
|
mkdir -m0755 -p "$(DESTDIR)$(mandir)/man1"
|
|
mkdir -m0755 -p "$(DESTDIR)$(mandir)/man5"
|
|
mkdir -m0755 -p "$(DESTDIR)$(mandir)/man7"
|
|
install -m0644 $(filter %.1.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man1
|
|
install -m0644 $(filter %.5.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man5
|
|
install -m0644 $(filter %.7.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man7
|
|
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
|
|
endif
|
|
|
|
$(dir)/config.dox: version.stamp
|
|
echo "PROJECT_NAME = \"Notmuch $(VERSION)\"" > $@
|
|
echo "INPUT=${srcdir}/lib/notmuch.h" >> $@
|
|
|
|
CLEAN := $(CLEAN) $(DOCBUILDDIR) $(DOCBUILDDIR)/.roff.stamp
|
|
CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES) $(dir)/conf.pyc $(dir)/config.dox
|