Makefile
48 lines
| 1.3 KiB
| text/x-makefile
|
MakefileLexer
/ doc / Makefile
|
r19426 | SOURCES=$(notdir $(wildcard ../mercurial/help/*.[0-9].txt)) | ||
|
r671 | MAN=$(SOURCES:%.txt=%) | ||
HTML=$(SOURCES:%.txt=%.html) | ||||
|
r12921 | GENDOC=gendoc.py ../mercurial/commands.py ../mercurial/help.py \ | ||
../mercurial/help/*.txt ../hgext/*.py ../hgext/*/__init__.py | ||||
|
r2233 | PREFIX=/usr/local | ||
|
r4030 | MANDIR=$(PREFIX)/share/man | ||
|
r7686 | INSTALL=install -c -m 644 | ||
|
r42225 | PYTHON?=python | ||
|
r13054 | RSTARGS= | ||
|
r465 | |||
|
r19427 | export HGENCODING=UTF-8 | ||
|
r9971 | |||
|
r1006 | all: man html | ||
|
r465 | |||
man: $(MAN) | ||||
html: $(HTML) | ||||
|
r42016 | # This logic is duplicated in setup.py:hgbuilddoc() | ||
|
r19426 | common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt): $(GENDOC) | ||
|
r34623 | ${PYTHON} gendoc.py "$(basename $@)" > $@.tmp | ||
|
r9444 | mv $@.tmp $@ | ||
|
r1814 | |||
|
r19426 | %: %.txt %.gendoc.txt common.txt | ||
|
r13054 | $(PYTHON) runrst hgmanpage $(RSTARGS) --halt warning \ | ||
|
r9445 | --strip-elements-with-class htmlonly $*.txt $* | ||
|
r465 | |||
|
r19426 | %.html: %.txt %.gendoc.txt common.txt | ||
|
r13054 | $(PYTHON) runrst html $(RSTARGS) --halt warning \ | ||
|
r9626 | --link-stylesheet --stylesheet-path style.css $*.txt $*.html | ||
|
r465 | |||
|
r3872 | MANIFEST: man html | ||
|
r9401 | # tracked files are already in the main MANIFEST | ||
|
r3872 | $(RM) $@ | ||
|
r12841 | for i in $(MAN) $(HTML); do \ | ||
|
r3872 | echo "doc/$$i" >> $@ ; \ | ||
done | ||||
|
r2233 | install: man | ||
for i in $(MAN) ; do \ | ||||
|
r8822 | subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \ | ||
|
r34623 | mkdir -p "$(DESTDIR)$(MANDIR)"/$$subdir ; \ | ||
$(INSTALL) $$i "$(DESTDIR)$(MANDIR)"/$$subdir ; \ | ||||
|
r2233 | done | ||
|
r465 | clean: | ||
|
r19426 | $(RM) $(MAN) $(HTML) common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt) MANIFEST | ||