doc/Makefile
changeset 9158 d6eecafaf12f
parent 9107 309c1d762e8e
child 9159 62b3df842de9
equal deleted inserted replaced
9157:9261667e9b82 9158:d6eecafaf12f
     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 ASCIIDOC=asciidoc
     8 RST2HTML=rst2html
       
     9 RST2MAN=rst2man
     9 
    10 
    10 all: man html
    11 all: man html
    11 
    12 
    12 man: $(MAN)
    13 man: $(MAN)
    13 
    14 
    17 	touch hg.1.txt
    18 	touch hg.1.txt
    18 
    19 
    19 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
    20 	${PYTHON} gendoc.py > $@
    21 	${PYTHON} gendoc.py > $@
    21 
    22 
    22 %: %.xml
    23 %: %.txt
    23 	xmlto man $*.xml && \
    24 	$(RST2MAN) $*.txt > $*
    24 	sed -e 's/^\.hg/\\\&.hg/' $* > $*~ && \
       
    25 	mv $*~ $*
       
    26 
       
    27 %.xml: %.txt
       
    28 	$(ASCIIDOC) -d manpage -b docbook $*.txt
       
    29 
    25 
    30 %.html: %.txt
    26 %.html: %.txt
    31 	$(ASCIIDOC) -b html4 $*.txt || $(ASCIIDOC) -b html $*.txt
    27 	$(RST2HTML) $*.txt > $*.html
    32 
    28 
    33 MANIFEST: man html
    29 MANIFEST: man html
    34 	# tracked files are already in the main MANIFEST
    30 	# tracked files are already in the main MANIFEST
    35 	$(RM) $@
    31 	$(RM) $@
    36 	for i in $(MAN) $(HTML) hg.1.gendoc.txt; do \
    32 	for i in $(MAN) $(HTML) hg.1.gendoc.txt; do \
    43 	  mkdir -p $(DESTDIR)$(MANDIR)/$$subdir ; \
    39 	  mkdir -p $(DESTDIR)$(MANDIR)/$$subdir ; \
    44 	  $(INSTALL) $$i $(DESTDIR)$(MANDIR)/$$subdir ; \
    40 	  $(INSTALL) $$i $(DESTDIR)$(MANDIR)/$$subdir ; \
    45 	done
    41 	done
    46 
    42 
    47 clean:
    43 clean:
    48 	$(RM) $(MAN) $(MAN:%=%.xml) $(MAN:%=%.html) *.[0-9].gendoc.txt MANIFEST
    44 	$(RM) $(MAN) $(MAN:%=%.html) *.[0-9].gendoc.txt MANIFEST