1MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard git-*.txt)) \
4 gitk.txt
5MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt
6MAN7_TXT=git.txt
7
8DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT))
9
10ARTICLES = tutorial
11ARTICLES += tutorial-2
12ARTICLES += core-tutorial
13ARTICLES += cvs-migration
14ARTICLES += diffcore
15ARTICLES += howto-index
16ARTICLES += repository-layout
17ARTICLES += hooks
18ARTICLES += everyday
19ARTICLES += git-tools
20ARTICLES += glossary
21# with their own formatting rules.
22SP_ARTICLES = howto/revert-branch-rebase user-manual
23
24DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
25
26DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
27DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
28DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
29
30prefix?=$(HOME)
31bindir?=$(prefix)/bin
32mandir?=$(prefix)/share/man
33man1dir=$(mandir)/man1
34man5dir=$(mandir)/man5
35man7dir=$(mandir)/man7
36# DESTDIR=
37
38ASCIIDOC=asciidoc
39ASCIIDOC_EXTRA =
40INSTALL?=install
41RM ?= rm -f
42DOC_REF = origin/man
43
44infodir?=$(prefix)/share/info
45MAKEINFO=makeinfo
46INSTALL_INFO=install-info
47DOCBOOK2X_TEXI=docbook2x-texi
48ifndef PERL_PATH
49 PERL_PATH = /usr/bin/perl
50endif
51
52-include ../config.mak.autogen
53-include ../config.mak
54
55ifdef ASCIIDOC8
56ASCIIDOC_EXTRA += -a asciidoc7compatible
57endif
58ifdef DOCBOOK_XSL_172
59ASCIIDOC_EXTRA += -a docbook-xsl-172
60endif
61
62#
63# Please note that there is a minor bug in asciidoc.
64# The version after 6.0.3 _will_ include the patch found here:
65# http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
66#
67# Until that version is released you may have to apply the patch
68# yourself - yes, all 6 characters of it!
69#
70
71all: html man
72
73html: $(DOC_HTML)
74
75$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
76
77man: man1 man5 man7
78man1: $(DOC_MAN1)
79man5: $(DOC_MAN5)
80man7: $(DOC_MAN7)
81
82info: git.info
83
84install: man
85 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
86 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
87 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
88 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
89 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
90 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
91
92install-info: info
93 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
94 $(INSTALL) -m 644 git.info $(DESTDIR)$(infodir)
95 if test -r $(DESTDIR)$(infodir)/dir; then \
96 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
97 else \
98 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
99 fi
100
101../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
102 $(MAKE) -C ../ GIT-VERSION-FILE
103
104-include ../GIT-VERSION-FILE
105
106#
107# Determine "include::" file references in asciidoc files.
108#
109doc.dep : $(wildcard *.txt) build-docdep.perl
110 $(RM) $@+ $@
111 $(PERL_PATH) ./build-docdep.perl >$@+
112 mv $@+ $@
113
114-include doc.dep
115
116cmds_txt = cmds-ancillaryinterrogators.txt \
117 cmds-ancillarymanipulators.txt \
118 cmds-mainporcelain.txt \
119 cmds-plumbinginterrogators.txt \
120 cmds-plumbingmanipulators.txt \
121 cmds-synchingrepositories.txt \
122 cmds-synchelpers.txt \
123 cmds-purehelpers.txt \
124 cmds-foreignscminterface.txt
125
126$(cmds_txt): cmd-list.made
127
128cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
129 $(RM) $@
130 $(PERL_PATH) ./cmd-list.perl ../command-list.txt
131 date >$@
132
133git.7 git.html: git.txt
134
135clean:
136 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 *.texi *.texi+ howto-index.txt howto/*.html doc.dep
137 $(RM) $(cmds_txt) *.made
138
139%.html : %.txt
140 $(RM) $@+ $@
141 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
142 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
143 mv $@+ $@
144
145%.1 %.5 %.7 : %.xml
146 $(RM) $@
147 xmlto -m callouts.xsl man $<
148
149%.xml : %.txt
150 $(RM) $@+ $@
151 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
152 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
153 mv $@+ $@
154
155user-manual.xml: user-manual.txt user-manual.conf
156 $(ASCIIDOC) -b docbook -d book $<
157
158XSLT = docbook.xsl
159XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
160
161user-manual.html: user-manual.xml
162 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
163
164git.info: user-manual.xml
165 $(RM) $@ $*.texi $*.texi+
166 $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout >$*.texi+
167 $(PERL_PATH) fix-texi.perl <$*.texi+ >$*.texi
168 $(MAKEINFO) --no-split $*.texi
169 $(RM) $*.texi $*.texi+
170
171howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
172 $(RM) $@+ $@
173 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
174 mv $@+ $@
175
176$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
177 $(ASCIIDOC) -b xhtml11 $*.txt
178
179WEBDOC_DEST = /pub/software/scm/git/docs
180
181$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
182 $(RM) $@+ $@
183 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
184 mv $@+ $@
185
186install-webdoc : html
187 sh ./install-webdoc.sh $(WEBDOC_DEST)
188
189quick-install:
190 sh ./install-doc-quick.sh $(DOC_REF) $(mandir)
191
192.PHONY: .FORCE-GIT-VERSION-FILE