Show More
@@ -1,48 +1,55 b'' | |||||
1 | SOURCES=$(notdir $(wildcard ../mercurial/helptext/*.[0-9].txt)) |
|
1 | SOURCES=$(notdir $(wildcard ../mercurial/helptext/*.[0-9].txt)) | |
2 | MAN=$(SOURCES:%.txt=%) |
|
2 | MAN=$(SOURCES:%.txt=%) | |
3 | HTML=$(SOURCES:%.txt=%.html) |
|
3 | HTML=$(SOURCES:%.txt=%.html) | |
4 | GENDOC=gendoc.py ../mercurial/commands.py ../mercurial/help.py \ |
|
4 | GENDOC=gendoc.py ../mercurial/commands.py ../mercurial/help.py \ | |
5 | ../mercurial/helptext/*.txt ../hgext/*.py ../hgext/*/__init__.py |
|
5 | ../mercurial/helptext/*.txt ../hgext/*.py ../hgext/*/__init__.py | |
6 | PREFIX=/usr/local |
|
6 | PREFIX=/usr/local | |
7 | MANDIR=$(PREFIX)/share/man |
|
7 | MANDIR=$(PREFIX)/share/man | |
8 | INSTALL=install -m 644 |
|
8 | INSTALL=install -m 644 | |
9 | PYTHON?=python |
|
9 | # Default to Python 3. | |
|
10 | # | |||
|
11 | # Windows ships Python 3 as `python.exe`, which may not be on PATH. py.exe is. | |||
|
12 | ifeq ($(OS),Windows_NT) | |||
|
13 | PYTHON?=py -3 | |||
|
14 | else | |||
|
15 | PYTHON?=python3 | |||
|
16 | endif | |||
10 | RSTARGS= |
|
17 | RSTARGS= | |
11 |
|
18 | |||
12 | export HGENCODING=UTF-8 |
|
19 | export HGENCODING=UTF-8 | |
13 |
|
20 | |||
14 | all: man html |
|
21 | all: man html | |
15 |
|
22 | |||
16 | man: $(MAN) |
|
23 | man: $(MAN) | |
17 |
|
24 | |||
18 | html: $(HTML) |
|
25 | html: $(HTML) | |
19 |
|
26 | |||
20 | # This logic is duplicated in setup.py:hgbuilddoc() |
|
27 | # This logic is duplicated in setup.py:hgbuilddoc() | |
21 | common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt): $(GENDOC) |
|
28 | common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt): $(GENDOC) | |
22 | ${PYTHON} gendoc.py "$(basename $@)" > $@.tmp |
|
29 | ${PYTHON} gendoc.py "$(basename $@)" > $@.tmp | |
23 | mv $@.tmp $@ |
|
30 | mv $@.tmp $@ | |
24 |
|
31 | |||
25 | %: %.txt %.gendoc.txt common.txt |
|
32 | %: %.txt %.gendoc.txt common.txt | |
26 | $(PYTHON) runrst hgmanpage $(RSTARGS) --halt warning \ |
|
33 | $(PYTHON) runrst hgmanpage $(RSTARGS) --halt warning \ | |
27 | --strip-elements-with-class htmlonly $*.txt $* |
|
34 | --strip-elements-with-class htmlonly $*.txt $* | |
28 |
|
35 | |||
29 | %.html: %.txt %.gendoc.txt common.txt |
|
36 | %.html: %.txt %.gendoc.txt common.txt | |
30 | $(PYTHON) runrst html $(RSTARGS) --halt warning \ |
|
37 | $(PYTHON) runrst html $(RSTARGS) --halt warning \ | |
31 | --link-stylesheet --stylesheet-path style.css $*.txt $*.html |
|
38 | --link-stylesheet --stylesheet-path style.css $*.txt $*.html | |
32 |
|
39 | |||
33 | MANIFEST: man html |
|
40 | MANIFEST: man html | |
34 | # tracked files are already in the main MANIFEST |
|
41 | # tracked files are already in the main MANIFEST | |
35 | $(RM) $@ |
|
42 | $(RM) $@ | |
36 | for i in $(MAN) $(HTML); do \ |
|
43 | for i in $(MAN) $(HTML); do \ | |
37 | echo "doc/$$i" >> $@ ; \ |
|
44 | echo "doc/$$i" >> $@ ; \ | |
38 | done |
|
45 | done | |
39 |
|
46 | |||
40 | install: man |
|
47 | install: man | |
41 | for i in $(MAN) ; do \ |
|
48 | for i in $(MAN) ; do \ | |
42 | subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \ |
|
49 | subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \ | |
43 | mkdir -p "$(DESTDIR)$(MANDIR)"/$$subdir ; \ |
|
50 | mkdir -p "$(DESTDIR)$(MANDIR)"/$$subdir ; \ | |
44 | $(INSTALL) $$i "$(DESTDIR)$(MANDIR)"/$$subdir ; \ |
|
51 | $(INSTALL) $$i "$(DESTDIR)$(MANDIR)"/$$subdir ; \ | |
45 | done |
|
52 | done | |
46 |
|
53 | |||
47 | clean: |
|
54 | clean: | |
48 | $(RM) $(MAN) $(HTML) common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt) MANIFEST |
|
55 | $(RM) $(MAN) $(HTML) common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt) MANIFEST |
General Comments 0
You need to be logged in to leave comments.
Login now