doc/Makefile
author Martin Geisler <mg@lazybytes.net>
Thu, 16 Jul 2009 23:25:26 +0200
changeset 9159 62b3df842de9
parent 9158 d6eecafaf12f
child 9161 e8b653a4b8da
permissions -rw-r--r--
doc: add newline after literal blocks in man pages The rst2man writer leaves no space between a literal block and the following paragraph. This patch corrects this. It has also been applied upstream. This does not conflict with this change since any number of newlines can be added without effecting the rendered man page.

SOURCES=$(wildcard *.[0-9].txt)
MAN=$(SOURCES:%.txt=%)
HTML=$(SOURCES:%.txt=%.html)
PREFIX=/usr/local
MANDIR=$(PREFIX)/share/man
INSTALL=install -c -m 644
PYTHON=python
RST2HTML=rst2html
RST2MAN=rst2man

all: man html

man: $(MAN)

html: $(HTML)

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

hg.1.gendoc.txt: gendoc.py ../mercurial/commands.py ../mercurial/help.py
	${PYTHON} gendoc.py > $@

%: %.txt
	# add newline after all literal blocks
	$(RST2MAN) $*.txt | sed -e 's/^\.fi$$/.fi\n/' > $*

%.html: %.txt
	$(RST2HTML) $*.txt > $*.html

MANIFEST: man html
	# tracked 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:%=%.html) *.[0-9].gendoc.txt MANIFEST