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