docs: don't mention --quiet or --exit-code in git-log(1)
[git/git.git] / Documentation / Makefile
CommitLineData
4a5d6939
MW
1MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard git-*.txt)) \
9e1f0a85 4 gitk.txt git.txt
30eba7bf
CC
5MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \
6 gitrepository-layout.txt
9e1f0a85 7MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \
30eba7bf 8 gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt \
d49483f0 9 gitdiffcore.txt gitnamespaces.txt gitrevisions.txt gitworkflows.txt
b790abb8 10
5cefc33b
JH
11MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
12MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
13MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
14
15DOC_HTML=$(MAN_HTML)
8db9307c 16
30eba7bf 17ARTICLES = howto-index
db9536c8 18ARTICLES += everyday
4a5d6939 19ARTICLES += git-tools
69a9cd31 20ARTICLES += git-bisect-lk2009
8db9307c 21# with their own formatting rules.
471a5ce5 22SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
530e741c
JH
23API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
24SP_ARTICLES += $(API_DOCS)
25SP_ARTICLES += technical/api-index
8db9307c
JH
26
27DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
789d5774 28
b2bf34d6 29DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
2d76548b 30DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
b2bf34d6
DG
31DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
32
d2b8593f 33prefix?=$(HOME)
e14421b9 34bindir?=$(prefix)/bin
5d6491c7 35htmldir?=$(prefix)/share/doc/git-doc
a325a1a7 36pdfdir?=$(prefix)/share/doc/git-doc
45fd8bd3 37mandir?=$(prefix)/share/man
7b8cf0cf 38man1dir=$(mandir)/man1
4392da4d 39man5dir=$(mandir)/man5
7b8cf0cf 40man7dir=$(mandir)/man7
a682ef9f 41# DESTDIR=
87a81c83 42
1187d756 43ASCIIDOC=asciidoc
26cfcfbf 44ASCIIDOC_EXTRA =
c30e9485 45MANPAGE_XSL = manpage-normal.xsl
5121a6d9 46XMLTO_EXTRA =
d2b8593f 47INSTALL?=install
4cb08df5 48RM ?= rm -f
6538d1ef 49DOC_REF = origin/man
6fe570de 50HTML_REF = origin/html
87a81c83 51
4739809c
DK
52infodir?=$(prefix)/share/info
53MAKEINFO=makeinfo
54INSTALL_INFO=install-info
55DOCBOOK2X_TEXI=docbook2x-texi
a325a1a7 56DBLATEX=dblatex
c680dd83
JH
57ifndef PERL_PATH
58 PERL_PATH = /usr/bin/perl
59endif
4739809c 60
95676853 61-include ../config.mak.autogen
4fa96e15 62-include ../config.mak
95676853 63
8fa2b45f
CJ
64#
65# For asciidoc ...
79c461d5
JK
66# -7.1.2, set ASCIIDOC7
67# 8.0-, no extra settings are needed
8fa2b45f
CJ
68#
69
70#
71# For docbook-xsl ...
79c461d5
JK
72# -1.68.1, no extra settings are needed?
73# 1.69.0, set ASCIIDOC_ROFF?
2346431e 74# 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
79c461d5 75# 1.71.1, set ASCIIDOC_ROFF?
8fa2b45f 76# 1.72.0, set DOCBOOK_XSL_172.
79c461d5 77# 1.73.0-, no extra settings are needed
8fa2b45f
CJ
78#
79
79c461d5 80ifndef ASCIIDOC7
71c020c5 81ASCIIDOC_EXTRA += -a asciidoc7compatible -a no-inline-literal
7f55cf45
JF
82endif
83ifdef DOCBOOK_XSL_172
8fa2b45f 84ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
7a2078b4 85MANPAGE_XSL = manpage-1.72.xsl
8fa2b45f 86else
79c461d5 87 ifndef ASCIIDOC_ROFF
8fa2b45f
CJ
88 # docbook-xsl after 1.72 needs the regular XSL, but will not
89 # pass-thru raw roff codes from asciidoc.conf, so turn them off.
90 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
91 endif
7f55cf45 92endif
5121a6d9
CJ
93ifdef MAN_BOLD_LITERAL
94XMLTO_EXTRA += -m manpage-bold-literal.xsl
95endif
2346431e
CJ
96ifdef DOCBOOK_SUPPRESS_SP
97XMLTO_EXTRA += -m manpage-suppress-sp.xsl
98endif
7f55cf45 99
8dd35c71 100# Newer DocBook stylesheet emits warning cruft in the output when
50d9bbba
TZ
101# this is not set, and if set it shows an absolute link. Older
102# stylesheets simply ignore this parameter.
59a0a0bd 103#
50d9bbba
TZ
104# Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
105# or similar.
106ifndef MAN_BASE_URL
107MAN_BASE_URL = file://$(htmldir)/
59a0a0bd 108endif
50d9bbba 109XMLTO_EXTRA += -m manpage-base-url.xsl
a479a564 110
204d363f
TR
111# If your target system uses GNU groff, it may try to render
112# apostrophes as a "pretty" apostrophe using unicode. This breaks
113# cut&paste, so you should set GNU_ROFF to force them to be ASCII
114# apostrophes. Unfortunately does not work with non-GNU roff.
115ifdef GNU_ROFF
116XMLTO_EXTRA += -m manpage-quote-apos.xsl
117endif
118
ee7ec2f9
BW
119SHELL_PATH ?= $(SHELL)
120# Shell quote;
121SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
122
b2bf34d6
DG
123#
124# Please note that there is a minor bug in asciidoc.
125# The version after 6.0.3 _will_ include the patch found here:
126# http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
127#
128# Until that version is released you may have to apply the patch
129# yourself - yes, all 6 characters of it!
130#
131
bb230097
CJ
132QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
133QUIET_SUBDIR1 =
134
135ifneq ($(findstring $(MAKEFLAGS),w),w)
136PRINT_DIR = --no-print-directory
137else # "make -w"
138NO_SUBDIR = :
139endif
140
141ifneq ($(findstring $(MAKEFLAGS),s),s)
142ifndef V
143 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
144 QUIET_XMLTO = @echo ' ' XMLTO $@;
145 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
146 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
147 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
148 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
149 QUIET_GEN = @echo ' ' GEN $@;
150 QUIET_STDERR = 2> /dev/null
151 QUIET_SUBDIR0 = +@subdir=
152 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
153 $(MAKE) $(PRINT_DIR) -C $$subdir
154 export V
155endif
156endif
157
b2bf34d6 158all: html man
b790abb8
DG
159
160html: $(DOC_HTML)
161
4392da4d 162$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
b2bf34d6 163
4392da4d 164man: man1 man5 man7
b2bf34d6 165man1: $(DOC_MAN1)
4392da4d 166man5: $(DOC_MAN5)
b2bf34d6 167man7: $(DOC_MAN7)
b790abb8 168
5cefc33b 169info: git.info gitman.info
4739809c 170
a325a1a7
MV
171pdf: user-manual.pdf
172
b1a46b70
MH
173install: install-man
174
175install-man: man
41650765
RS
176 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
177 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
178 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
179 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
180 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
181 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
87a81c83 182
4739809c 183install-info: info
41650765 184 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
5cefc33b 185 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
4739809c
DK
186 if test -r $(DESTDIR)$(infodir)/dir; then \
187 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
5cefc33b 188 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
4739809c
DK
189 else \
190 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
191 fi
37465016 192
a325a1a7
MV
193install-pdf: pdf
194 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
195 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
196
5d6491c7 197install-html: html
ee7ec2f9 198 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
5d6491c7 199
13fca9f3 200../GIT-VERSION-FILE: FORCE
bb230097 201 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
7b8a74f3
FL
202
203-include ../GIT-VERSION-FILE
204
93d69d86
JL
205#
206# Determine "include::" file references in asciidoc files.
207#
fb612d54 208doc.dep : $(wildcard *.txt) build-docdep.perl
bb230097
CJ
209 $(QUIET_GEN)$(RM) $@+ $@ && \
210 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
a5ae8e64 211 mv $@+ $@
93d69d86 212
a5ae8e64 213-include doc.dep
37465016 214
72fe6a59
JH
215cmds_txt = cmds-ancillaryinterrogators.txt \
216 cmds-ancillarymanipulators.txt \
217 cmds-mainporcelain.txt \
218 cmds-plumbinginterrogators.txt \
219 cmds-plumbingmanipulators.txt \
89bf2077
JH
220 cmds-synchingrepositories.txt \
221 cmds-synchelpers.txt \
222 cmds-purehelpers.txt \
223 cmds-foreignscminterface.txt
72fe6a59 224
d7907392
JH
225$(cmds_txt): cmd-list.made
226
79d30668 227cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
bb230097
CJ
228 $(QUIET_GEN)$(RM) $@ && \
229 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
d7907392 230 date >$@
b790abb8
DG
231
232clean:
4c785e50 233 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
c6a5ad21 234 $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
ae8044a2 235 $(RM) *.pdf
530e741c
JH
236 $(RM) howto-index.txt howto/*.html doc.dep
237 $(RM) technical/api-*.html technical/api-index.txt
4cb08df5 238 $(RM) $(cmds_txt) *.made
50d9bbba 239 $(RM) manpage-base-url.xsl
b790abb8 240
530e741c 241$(MAN_HTML): %.html : %.txt
bb230097 242 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
7b8a74f3 243 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
bb230097 244 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
7b8a74f3 245 mv $@+ $@
b790abb8 246
50d9bbba
TZ
247manpage-base-url.xsl: manpage-base-url.xsl.in
248 sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
249
250%.1 %.5 %.7 : %.xml manpage-base-url.xsl
bb230097 251 $(QUIET_XMLTO)$(RM) $@ && \
5121a6d9 252 xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
b790abb8
DG
253
254%.xml : %.txt
bb230097 255 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
7b8a74f3 256 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
bb230097 257 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
7b8a74f3 258 mv $@+ $@
3f971fc4 259
d19fbc3c 260user-manual.xml: user-manual.txt user-manual.conf
f9dae0d3
JN
261 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
262 $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book -o $@+ $< && \
263 mv $@+ $@
d19fbc3c 264
530e741c
JH
265technical/api-index.txt: technical/api-index-skel.txt \
266 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
ee7ec2f9 267 $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
530e741c
JH
268
269$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
bb230097 270 $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
530e741c
JH
271 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
272
1cffddd6 273XSLT = docbook.xsl
0a3985dc 274XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
1c95c565 275
f2aff316 276user-manual.html: user-manual.xml $(XSLT)
f9dae0d3
JN
277 $(QUIET_XSLTPROC)$(RM) $@+ $@ && \
278 xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
279 mv $@+ $@
d19fbc3c 280
50b3555c 281git.info: user-manual.texi
bb230097 282 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
5cefc33b 283
50b3555c 284user-manual.texi: user-manual.xml
bb230097 285 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
c6a5ad21
CJ
286 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
287 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
288 rm $@++ && \
5cefc33b
JH
289 mv $@+ $@
290
a325a1a7 291user-manual.pdf: user-manual.xml
bb230097
CJ
292 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
293 $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
a325a1a7
MV
294 mv $@+ $@
295
5cefc33b 296gitman.texi: $(MAN_XML) cat-texi.perl
bb230097 297 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
8b30ad01 298 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
c6a5ad21
CJ
299 --to-stdout $(xml) &&) true) > $@++ && \
300 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
301 rm $@++ && \
5cefc33b
JH
302 mv $@+ $@
303
304gitman.info: gitman.texi
bb230097 305 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
5cefc33b
JH
306
307$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
bb230097
CJ
308 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
309 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
5cefc33b 310 mv $@+ $@
4739809c 311
e6fc2346 312howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
bb230097 313 $(QUIET_GEN)$(RM) $@+ $@ && \
ee7ec2f9 314 '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
e6fc2346
JH
315 mv $@+ $@
316
8db9307c 317$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
26e47f25 318 $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 $*.txt
e6fc2346
JH
319
320WEBDOC_DEST = /pub/software/scm/git/docs
321
8d0991d7 322$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
bb230097 323 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
26e47f25 324 sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \
8d0991d7
JH
325 mv $@+ $@
326
e6fc2346 327install-webdoc : html
ee7ec2f9 328 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
6538d1ef 329
b1a46b70
MH
330quick-install: quick-install-man
331
332quick-install-man:
ee7ec2f9 333 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
7b8a74f3 334
6fe570de 335quick-install-html:
ee7ec2f9 336 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
6fe570de 337
13fca9f3 338.PHONY: FORCE