Add myself to the AUTHORS file
[stgit] / Documentation / Makefile
CommitLineData
575bbdae
KH
1COMMANDS = $(shell ../stg-build --commands)
2COMMANDS_TXT = $(patsubst %,stg-%.txt,$(COMMANDS))
3
a0ce5562 4MAN1_TXT= stg.txt $(COMMANDS_TXT)
4ec67741 5
bd1f46ed 6DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT))
4ec67741 7
368a44c3
YD
8ARTICLES =
9# with their own formatting rules.
10SP_ARTICLES = tutorial
11
12DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
13DOC_PDF += $(patsubst %,%.pdf,$(ARTICLES) $(SP_ARTICLES))
14
4ec67741 15DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
4ec67741
YD
16
17prefix?=$(HOME)
fd52912d 18htmldir?=$(prefix)/share/doc/stgit
491c9d5a 19mandir?=$(prefix)/share/man
4ec67741 20man1dir=$(mandir)/man1
4ec67741
YD
21# DESTDIR=
22
23ASCIIDOC=asciidoc --unsafe
24ASCIIDOC_EXTRA =
25INSTALL?=install
26
27#
28# Please note that there is a minor bug in asciidoc.
29# The version after 6.0.3 _will_ include the patch found here:
30# http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
31#
32# Until that version is released you may have to apply the patch
33# yourself - yes, all 6 characters of it!
34#
35
36all: html man
37
38html: $(DOC_HTML)
368a44c3 39pdf: $(DOC_PDF)
4ec67741 40
bd1f46ed 41$(DOC_HTML) $(DOC_MAN1): asciidoc.conf
4ec67741 42
bd1f46ed 43man: man1
4ec67741 44man1: $(DOC_MAN1)
4ec67741 45install: man
bd1f46ed 46 $(INSTALL) -d -m755 $(DESTDIR)$(man1dir)
4ec67741 47 $(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
fd52912d
DW
48
49install-html: html
50 $(INSTALL) -d -m755 $(DESTDIR)$(htmldir)
51 $(INSTALL) -m644 $(DOC_HTML) $(DESTDIR)$(htmldir)
4ec67741
YD
52#
53# Determine "include::" file references in asciidoc files.
54#
55doc.dep : $(wildcard *.txt) build-docdep.perl
56 rm -f $@+ $@
57 perl ./build-docdep.perl >$@+
58 mv $@+ $@
59
60-include doc.dep
61
62clean:
a0ce5562 63 rm -f *.xml *.html *.pdf *.1 doc.dep $(COMMANDS_TXT) command-list.txt
575bbdae 64
33ff9cdd
KH
65ALL_PY = $(shell find ../stgit -name '*.py')
66
67$(COMMANDS_TXT): $(ALL_PY)
575bbdae 68 ../stg-build --asciidoc $(basename $(subst stg-,,$@)) > $@
4ec67741 69
a0ce5562 70command-list.txt: $(ALL_PY)
33ff9cdd
KH
71 ../stg-build --cmd-list > $@
72
4ec67741
YD
73%.html : %.txt
74 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $<
75
bd1f46ed 76%.1 : %.xml
4ec67741
YD
77 xmlto -m callouts.xsl man $<
78
79%.xml : %.txt
80 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf $<
368a44c3
YD
81
82%.pdf: %.xml
83 xmlto pdf $<
84
85# special formatting rules
86tutorial.html : %.html : %.txt
87 $(ASCIIDOC) -b xhtml11 -d article -f tutorial.conf $(ASCIIDOC_EXTRA) $<
88tutorial.xml : %.xml : %.txt
89 $(ASCIIDOC) -b docbook -d article -f tutorial.conf $<