comparison doc/Makefile @ 9418:a82db54bc3be

doc: use our own rst2man.py script (issue1746) The rst2man tool has not yet been part of an official Docutils release, and it is not present in most distributions. This poses a problem for people who want to install Mercurial from source, or who want to create a Mercurial package for such a distribution -- how to specify the build-dependencies? By including the rst2man.py script with Mercurial people only need a normal Docutils installation in order to install Mercurial.
author Martin Geisler <mg@lazybytes.net>
date Thu, 03 Sep 2009 21:36:44 +0200
parents 7345fa5e572e
children ec26d6986d85
comparison
equal deleted inserted replaced
9417:4c3fb45123e5 9418:a82db54bc3be
4 PREFIX=/usr/local 4 PREFIX=/usr/local
5 MANDIR=$(PREFIX)/share/man 5 MANDIR=$(PREFIX)/share/man
6 INSTALL=install -c -m 644 6 INSTALL=install -c -m 644
7 PYTHON=python 7 PYTHON=python
8 RST2HTML=$(shell which rst2html 2> /dev/null || which rst2html.py) 8 RST2HTML=$(shell which rst2html 2> /dev/null || which rst2html.py)
9 RST2MAN=$(shell which rst2man 2> /dev/null || which rst2man.py)
10 9
11 all: man html 10 all: man html
12 11
13 man: $(MAN) 12 man: $(MAN)
14 13
19 18
20 hg.1.gendoc.txt: gendoc.py ../mercurial/commands.py ../mercurial/help.py 19 hg.1.gendoc.txt: gendoc.py ../mercurial/commands.py ../mercurial/help.py
21 ${PYTHON} gendoc.py > $@ 20 ${PYTHON} gendoc.py > $@
22 21
23 %: %.txt common.txt 22 %: %.txt common.txt
24 $(RST2MAN) $*.txt > $*.tmp 23 $(PYTHON) rst2man.py $*.txt > $*
25 # add newline after all literal blocks and fix backslash escape
26 sed \
27 -e 's/^\.fi$$/.fi\n/' \
28 -e 's/\\fB\\\\fP/\\fB\\e\\fP/' \
29 $*.tmp > $*
30 rm $*.tmp
31 24
32 %.html: %.txt common.txt 25 %.html: %.txt common.txt
33 $(RST2HTML) $*.txt > $*.html 26 $(RST2HTML) $*.txt > $*.html
34 27
35 MANIFEST: man html 28 MANIFEST: man html