doc/Makefile
author Martin Geisler <mg@lazybytes.net>
Thu, 16 Jul 2009 23:25:26 +0200
changeset 9158 d6eecafaf12f
parent 9107 309c1d762e8e
child 9159 62b3df842de9
permissions -rw-r--r--
doc: use reStructuredText for man and HTML pages The Makefile now requires the rst2html and rst2man programs. Both can be found in Debian testing or downloaded from the Docutils homepage: http://docutils.sf.net/ http://docutils.sf.net/sandbox/manpage-writer/ The new HTML and man pages no longer contain huge amounts of un-wrapping literal blocks, thanks to how snippets of reStructuredText can easily be included inside other reStructuredText documents. The HTML pages now have anchors for all sections, including the help topics in hgrc.1 which were missing from the old HTML pages.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
671
efa4a7e2f322 Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents: 465
diff changeset
     1
SOURCES=$(wildcard *.[0-9].txt)
efa4a7e2f322 Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents: 465
diff changeset
     2
MAN=$(SOURCES:%.txt=%)
efa4a7e2f322 Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents: 465
diff changeset
     3
HTML=$(SOURCES:%.txt=%.html)
2233
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 1879
diff changeset
     4
PREFIX=/usr/local
4030
a48971ae1387 install man pages by default into $(PREFIX)/share/man not $(PREFIX)/man since the FHS puts them there
Jonathan Smith <https://issues.rpath.com/>
parents: 3908
diff changeset
     5
MANDIR=$(PREFIX)/share/man
7686
fa584d23e3cc Do not install executable man pages
Christian Ebert <blacktrash@gmx.net>
parents: 7660
diff changeset
     6
INSTALL=install -c -m 644
6724
2e58f1a36046 use ${PYTHON} var in doc/Makefile as well
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6486
diff changeset
     7
PYTHON=python
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9107
diff changeset
     8
RST2HTML=rst2html
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9107
diff changeset
     9
RST2MAN=rst2man
465
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    10
1006
b0e581438835 Generate html documentation by default, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 671
diff changeset
    11
all: man html
465
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    12
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    13
man: $(MAN)
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    14
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    15
html: $(HTML)
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    16
1814
7956893e8458 generate hg manpage from commands.py docstring
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1689
diff changeset
    17
hg.1.txt: hg.1.gendoc.txt
7956893e8458 generate hg manpage from commands.py docstring
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1689
diff changeset
    18
	touch hg.1.txt
7956893e8458 generate hg manpage from commands.py docstring
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1689
diff changeset
    19
9107
309c1d762e8e doc/Makefile: let hg1.gendoc.txt depend on gendoc.py
Martin Geisler <mg@lazybytes.net>
parents: 8822
diff changeset
    20
hg.1.gendoc.txt: gendoc.py ../mercurial/commands.py ../mercurial/help.py
6724
2e58f1a36046 use ${PYTHON} var in doc/Makefile as well
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6486
diff changeset
    21
	${PYTHON} gendoc.py > $@
1814
7956893e8458 generate hg manpage from commands.py docstring
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1689
diff changeset
    22
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9107
diff changeset
    23
%: %.txt
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9107
diff changeset
    24
	$(RST2MAN) $*.txt > $*
465
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    25
671
efa4a7e2f322 Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents: 465
diff changeset
    26
%.html: %.txt
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9107
diff changeset
    27
	$(RST2HTML) $*.txt > $*.html
465
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    28
3872
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3269
diff changeset
    29
MANIFEST: man html
6943
2ca70663ded3 doc/Makefile: rephrase comment (typo)
Christian Ebert <blacktrash@gmx.net>
parents: 6724
diff changeset
    30
	# tracked files are already in the main MANIFEST
3872
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3269
diff changeset
    31
	$(RM) $@
3908
8020c35b6455 Include hg.1.gendoc.txt in doc/MANIFEST to prevent unnecessary rebuild.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3907
diff changeset
    32
	for i in $(MAN) $(HTML) hg.1.gendoc.txt; do \
3872
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3269
diff changeset
    33
	  echo "doc/$$i" >> $@ ; \
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3269
diff changeset
    34
	done
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3269
diff changeset
    35
2233
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 1879
diff changeset
    36
install: man
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 1879
diff changeset
    37
	for i in $(MAN) ; do \
8822
1027da7d2fb9 doc: fix regexp for determining the man page section
Cédric Duval <cedricduval@free.fr>
parents: 8311
diff changeset
    38
	  subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \
4753
620cea146b19 mercurial.spec: include CONTRIBUTORS, COPYING and man pages in rpm
Adam Spiers <hg@adamspiers.org>
parents: 4032
diff changeset
    39
	  mkdir -p $(DESTDIR)$(MANDIR)/$$subdir ; \
620cea146b19 mercurial.spec: include CONTRIBUTORS, COPYING and man pages in rpm
Adam Spiers <hg@adamspiers.org>
parents: 4032
diff changeset
    40
	  $(INSTALL) $$i $(DESTDIR)$(MANDIR)/$$subdir ; \
2233
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 1879
diff changeset
    41
	done
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 1879
diff changeset
    42
465
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    43
clean:
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9107
diff changeset
    44
	$(RM) $(MAN) $(MAN:%=%.html) *.[0-9].gendoc.txt MANIFEST