doc/Makefile
author Kirill Smelkov <kirr@mns.spb.ru>
Fri, 28 Dec 2007 00:03:55 -0600
changeset 5751 bc475d1f74ca
parent 4753 620cea146b19
child 6486 960bc707ea10
permissions -rw-r--r--
prompt: kill matchflags Python already lets one to embed RE flags directly in a regex, which is a much nicer way to do things: (?iLmsux) (One or more letters from the set "i", "L", "m", "s", "u", "x".) ... matchflags was introduced in 67afecb8d6cc, and the record extension is the only user. I've killed matchflag, and adjusted record code appropriately.

SOURCES=$(wildcard *.[0-9].txt)
MAN=$(SOURCES:%.txt=%)
HTML=$(SOURCES:%.txt=%.html)
PREFIX=/usr/local
MANDIR=$(PREFIX)/share/man
INSTALL=install -c

all: man html

man: $(MAN)

html: $(HTML)

hg.1.txt: hg.1.gendoc.txt
	touch hg.1.txt

hg.1.gendoc.txt: ../mercurial/commands.py ../mercurial/help.py
	python gendoc.py > $@

%: %.xml
	xmlto man $*.xml

%.xml: %.txt
	asciidoc -d manpage -b docbook $*.txt

%.html: %.txt
	asciidoc -b html4 $*.txt || asciidoc -b html $*.txt

MANIFEST: man html
	# versionned files are already in the main MANIFEST
	$(RM) $@
	for i in $(MAN) $(HTML) hg.1.gendoc.txt; do \
	  echo "doc/$$i" >> $@ ; \
	done

install: man
	for i in $(MAN) ; do \
	  subdir=`echo $$i | sed -n 's/..*\.\([0-9]\)$$/man\1/p'` ; \
	  mkdir -p $(DESTDIR)$(MANDIR)/$$subdir ; \
	  $(INSTALL) $$i $(DESTDIR)$(MANDIR)/$$subdir ; \
	done

clean:
	$(RM) $(MAN) $(MAN:%=%.xml) $(MAN:%=%.html) *.[0-9].gendoc.txt MANIFEST