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