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