Merge refs/heads/master from .
[git.git] / Documentation / Makefile
1 MAN1_TXT=$(wildcard git-*.txt) gitk.txt
2 MAN7_TXT=git.txt
3
4 DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT))
5
6 ARTICLES = tutorial cvs-migration diffcore howto-index
7 # with their own formatting rules.
8 SP_ARTICLES = glossary howto/revert-branch-rebase
9
10 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
11
12 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
13 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
14
15 prefix=$(HOME)
16 bin=$(prefix)/bin
17 mandir=$(prefix)/man
18 man1=$(mandir)/man1
19 man7=$(mandir)/man7
20 # DESTDIR=
21
22 INSTALL=install
23
24 #
25 # Please note that there is a minor bug in asciidoc.
26 # The version after 6.0.3 _will_ include the patch found here:
27 #   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
28 #
29 # Until that version is released you may have to apply the patch
30 # yourself - yes, all 6 characters of it!
31 #
32
33 all: html man
34
35 html: $(DOC_HTML)
36
37
38 man: man1 man7
39 man1: $(DOC_MAN1)
40 man7: $(DOC_MAN7)
41
42 install:
43         $(INSTALL) -m755 -d $(DESTDIR)/$(man1) $(DESTDIR)/$(man7)
44         $(INSTALL) $(DOC_MAN1) $(DESTDIR)/$(man1)
45         $(INSTALL) $(DOC_MAN7) $(DESTDIR)/$(man7)
46
47 # 'include' dependencies
48 git-diff-%.txt: diff-format.txt diff-options.txt
49         touch $@
50
51 clean:
52         rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html
53
54 %.html : %.txt
55         asciidoc -b xhtml11 -d manpage $<
56
57 %.1 %.7 : %.xml
58         xmlto man $<
59
60 %.xml : %.txt
61         asciidoc -b docbook -d manpage $<
62
63 git.html: git.txt ../README
64
65 glossary.html : glossary.txt sort_glossary.pl
66         cat $< | \
67         perl sort_glossary.pl | \
68         asciidoc -b xhtml11 - > glossary.html
69
70 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
71         rm -f $@+ $@
72         sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
73         mv $@+ $@
74
75 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
76         asciidoc -b xhtml11 $*.txt
77
78 WEBDOC_DEST = /pub/software/scm/git/docs
79
80 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
81         rm -f $@+ $@
82         sed -e '1,/^$$/d' $? | asciidoc -b xhtml11 - >$@+
83         mv $@+ $@
84
85 install-webdoc : html
86         sh ./install-webdoc.sh $(WEBDOC_DEST)