stgit.el: Garbage collect selected patches on reload
[stgit] / Documentation / Makefile
1 COMMANDS = $(shell ../stg-build --commands)
2 COMMANDS_TXT = $(patsubst %,stg-%.txt,$(COMMANDS))
3
4 MAN1_TXT= stg.txt $(COMMANDS_TXT)
5
6 DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT))
7
8 ARTICLES = tutorial
9
10 DOC_HTML += $(patsubst %,%.html,$(ARTICLES))
11 DOC_PDF += $(patsubst %,%.pdf,$(ARTICLES))
12
13 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
14
15 prefix?=$(HOME)
16 htmldir?=$(prefix)/share/doc/stgit
17 mandir?=$(prefix)/share/man
18 man1dir=$(mandir)/man1
19 # DESTDIR=
20
21 ASCIIDOC=asciidoc --unsafe
22 ASCIIDOC_EXTRA =
23 INSTALL?=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
34 all: html man
35
36 html: $(DOC_HTML)
37 pdf: $(DOC_PDF)
38
39 $(DOC_HTML) $(DOC_MAN1): asciidoc.conf
40
41 man: man1
42 man1: $(DOC_MAN1)
43 install: man
44 $(INSTALL) -d -m755 $(DESTDIR)$(man1dir)
45 $(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
46
47 install-html: html
48 $(INSTALL) -d -m755 $(DESTDIR)$(htmldir)
49 $(INSTALL) -m644 $(DOC_HTML) $(DESTDIR)$(htmldir)
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 doc.dep $(COMMANDS_TXT) command-list.txt
62
63 ALL_PY = $(shell find ../stgit -name '*.py')
64
65 $(COMMANDS_TXT): $(ALL_PY)
66 ../stg-build --asciidoc $(basename $(subst stg-,,$@)) > $@
67
68 command-list.txt: $(ALL_PY)
69 ../stg-build --cmd-list > $@
70
71 %.html : %.txt
72 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $<
73
74 %.1 : %.xml
75 xmlto -m callouts.xsl man $<
76
77 %.xml : %.txt
78 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf $<
79
80 %.pdf: %.xml
81 xmlto pdf $<
82
83 # special formatting rules
84 tutorial.html : %.html : %.txt
85 $(ASCIIDOC) -b xhtml11 -d article -a toc -f tutorial.conf \
86 $(ASCIIDOC_EXTRA) $<
87 tutorial.xml : %.xml : %.txt
88 $(ASCIIDOC) -b docbook -d article -f tutorial.conf $<