f4cbf7e159be721bf17625b07c1d7b4f36c60f78
[git.git] / Documentation / Makefile
1 MAN1_TXT= \
2         $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3                 $(wildcard git-*.txt)) \
4         gitk.txt
5 MAN7_TXT=git.txt
6
7 DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT))
8
9 ARTICLES = tutorial
10 ARTICLES += core-tutorial
11 ARTICLES += cvs-migration
12 ARTICLES += diffcore
13 ARTICLES += howto-index
14 ARTICLES += repository-layout
15 ARTICLES += hooks
16 ARTICLES += everyday
17 ARTICLES += git-tools
18 # with their own formatting rules.
19 SP_ARTICLES = glossary howto/revert-branch-rebase
20
21 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
22
23 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
24 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
25
26 prefix?=$(HOME)
27 bin=$(prefix)/bin
28 mandir=$(prefix)/man
29 man1=$(mandir)/man1
30 man7=$(mandir)/man7
31 # DESTDIR=
32
33 INSTALL?=install
34
35 #
36 # Please note that there is a minor bug in asciidoc.
37 # The version after 6.0.3 _will_ include the patch found here:
38 #   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
39 #
40 # Until that version is released you may have to apply the patch
41 # yourself - yes, all 6 characters of it!
42 #
43
44 all: html man
45
46 html: $(DOC_HTML)
47
48
49 man: man1 man7
50 man1: $(DOC_MAN1)
51 man7: $(DOC_MAN7)
52
53 install: man
54         $(INSTALL) -d -m755 $(DESTDIR)/$(man1) $(DESTDIR)/$(man7)
55         $(INSTALL) $(DOC_MAN1) $(DESTDIR)/$(man1)
56         $(INSTALL) $(DOC_MAN7) $(DESTDIR)/$(man7)
57
58
59 #
60 # Determine "include::" file references in asciidoc files.
61 #
62 doc.dep : $(wildcard *.txt) build-docdep.perl
63         rm -f $@+ $@
64         perl ./build-docdep.perl >$@+
65         mv $@+ $@
66
67 -include doc.dep
68
69 git.7: README
70
71 README: ../README
72         cp $< $@
73
74
75 clean:
76         rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep README
77
78 %.html : %.txt
79         asciidoc -b xhtml11 -d manpage -f asciidoc.conf $<
80
81 %.1 %.7 : %.xml
82         xmlto man $<
83
84 %.xml : %.txt
85         asciidoc -b docbook -d manpage -f asciidoc.conf $<
86
87 git.html: git.txt README
88
89 glossary.html : glossary.txt sort_glossary.pl
90         cat $< | \
91         perl sort_glossary.pl | \
92         asciidoc -b xhtml11 - > glossary.html
93
94 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
95         rm -f $@+ $@
96         sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
97         mv $@+ $@
98
99 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
100         asciidoc -b xhtml11 $*.txt
101
102 WEBDOC_DEST = /pub/software/scm/git/docs
103
104 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
105         rm -f $@+ $@
106         sed -e '1,/^$$/d' $? | asciidoc -b xhtml11 - >$@+
107         mv $@+ $@
108
109 install-webdoc : html
110         sh ./install-webdoc.sh $(WEBDOC_DEST)