chiark / gitweb /
Don't split long and short description in "stg edit"
[stgit] / Documentation / Makefile
1 MAN1_TXT=$(wildcard stg*.txt)
2 MAN7_TXT=
3
4 DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT))
5
6 ARTICLES = 
7 # with their own formatting rules.
8 SP_ARTICLES = tutorial
9
10 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
11 DOC_PDF += $(patsubst %,%.pdf,$(ARTICLES) $(SP_ARTICLES))
12
13 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
14 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
15
16 prefix?=$(HOME)
17 mandir?=$(prefix)/man
18 man1dir=$(mandir)/man1
19 man7dir=$(mandir)/man7
20 # DESTDIR=
21
22 ASCIIDOC=asciidoc --unsafe
23 ASCIIDOC_EXTRA =
24 INSTALL?=install
25
26 #
27 # Please note that there is a minor bug in asciidoc.
28 # The version after 6.0.3 _will_ include the patch found here:
29 #   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
30 #
31 # Until that version is released you may have to apply the patch
32 # yourself - yes, all 6 characters of it!
33 #
34
35 all: html man
36
37 html: $(DOC_HTML)
38 pdf: $(DOC_PDF)
39
40 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN7): asciidoc.conf
41
42 man: man1 man7
43 man1: $(DOC_MAN1)
44 man7: $(DOC_MAN7)
45
46 install: man
47         $(INSTALL) -d -m755 $(DESTDIR)$(man1dir) $(DESTDIR)$(man7dir)
48         $(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
49         $(INSTALL) -m644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
50 #
51 # Determine "include::" file references in asciidoc files.
52 #
53 doc.dep : $(wildcard *.txt) build-docdep.perl
54         rm -f $@+ $@
55         perl ./build-docdep.perl >$@+
56         mv $@+ $@
57
58 -include doc.dep
59
60 clean:
61         rm -f *.xml *.html *.pdf *.1 *.7 doc.dep
62
63 %.html : %.txt
64         $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $<
65
66 %.1 %.7 : %.xml
67         xmlto -m callouts.xsl man $<
68
69 %.xml : %.txt
70         $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf $<
71
72 %.pdf: %.xml
73         xmlto pdf $<
74
75 # special formatting rules
76 tutorial.html : %.html : %.txt
77         $(ASCIIDOC) -b xhtml11 -d article -f tutorial.conf $(ASCIIDOC_EXTRA) $<
78 tutorial.xml : %.xml : %.txt
79         $(ASCIIDOC) -b docbook -d article -f tutorial.conf $<