Show More
@@ -1,50 +1,50 b'' | |||||
1 | SOURCES=$(wildcard *.[0-9].txt) |
|
1 | SOURCES=$(wildcard *.[0-9].txt) | |
2 | MAN=$(SOURCES:%.txt=%) |
|
2 | MAN=$(SOURCES:%.txt=%) | |
3 | HTML=$(SOURCES:%.txt=%.html) |
|
3 | HTML=$(SOURCES:%.txt=%.html) | |
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=rst2html |
|
8 | RST2HTML=rst2html | |
9 | RST2MAN=rst2man |
|
9 | RST2MAN=rst2man | |
10 |
|
10 | |||
11 | all: man html |
|
11 | all: man html | |
12 |
|
12 | |||
13 | man: $(MAN) |
|
13 | man: $(MAN) | |
14 |
|
14 | |||
15 | html: $(HTML) |
|
15 | html: $(HTML) | |
16 |
|
16 | |||
17 | hg.1.txt: hg.1.gendoc.txt |
|
17 | hg.1.txt: hg.1.gendoc.txt | |
18 | touch hg.1.txt |
|
18 | touch hg.1.txt | |
19 |
|
19 | |||
20 | hg.1.gendoc.txt: gendoc.py ../mercurial/commands.py ../mercurial/help.py |
|
20 | hg.1.gendoc.txt: gendoc.py ../mercurial/commands.py ../mercurial/help.py | |
21 | ${PYTHON} gendoc.py > $@ |
|
21 | ${PYTHON} gendoc.py > $@ | |
22 |
|
22 | |||
23 | %: %.txt common.txt |
|
23 | %: %.txt common.txt | |
24 | $(RST2MAN) $*.txt > $*.tmp |
|
24 | $(RST2MAN) $*.txt > $*.tmp | |
25 |
|
|
25 | # add newline after all literal blocks and fix backslash escape | |
26 | sed \ |
|
26 | sed \ | |
27 | -e 's/^\.fi$$/.fi\n/' \ |
|
27 | -e 's/^\.fi$$/.fi\n/' \ | |
28 | -e 's/\\fB\\\\fP/\\fB\\e\\fP/' \ |
|
28 | -e 's/\\fB\\\\fP/\\fB\\e\\fP/' \ | |
29 | $*.tmp > $* |
|
29 | $*.tmp > $* | |
30 | rm $*.tmp |
|
30 | rm $*.tmp | |
31 |
|
31 | |||
32 | %.html: %.txt common.txt |
|
32 | %.html: %.txt common.txt | |
33 | $(RST2HTML) $*.txt > $*.html |
|
33 | $(RST2HTML) $*.txt > $*.html | |
34 |
|
34 | |||
35 | MANIFEST: man html |
|
35 | MANIFEST: man html | |
36 |
|
|
36 | # tracked files are already in the main MANIFEST | |
37 | $(RM) $@ |
|
37 | $(RM) $@ | |
38 | for i in $(MAN) $(HTML) hg.1.gendoc.txt; do \ |
|
38 | for i in $(MAN) $(HTML) hg.1.gendoc.txt; do \ | |
39 | echo "doc/$$i" >> $@ ; \ |
|
39 | echo "doc/$$i" >> $@ ; \ | |
40 | done |
|
40 | done | |
41 |
|
41 | |||
42 | install: man |
|
42 | install: man | |
43 | for i in $(MAN) ; do \ |
|
43 | for i in $(MAN) ; do \ | |
44 | subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \ |
|
44 | subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \ | |
45 | mkdir -p $(DESTDIR)$(MANDIR)/$$subdir ; \ |
|
45 | mkdir -p $(DESTDIR)$(MANDIR)/$$subdir ; \ | |
46 | $(INSTALL) $$i $(DESTDIR)$(MANDIR)/$$subdir ; \ |
|
46 | $(INSTALL) $$i $(DESTDIR)$(MANDIR)/$$subdir ; \ | |
47 | done |
|
47 | done | |
48 |
|
48 | |||
49 | clean: |
|
49 | clean: | |
50 | $(RM) $(MAN) $(MAN:%=%.html) *.[0-9].gendoc.txt MANIFEST |
|
50 | $(RM) $(MAN) $(MAN:%=%.html) *.[0-9].gendoc.txt MANIFEST |
General Comments 0
You need to be logged in to leave comments.
Login now