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