Merge branch 'dk/raise-core-deltabasecachelimit'
[git/raj.git] / Documentation / Makefile
blobfc6b2cf9ec0d2582b89d65ab6976275c4756bca5
1 # Guard against environment variables
2 MAN1_TXT =
3 MAN5_TXT =
4 MAN7_TXT =
5 TECH_DOCS =
6 ARTICLES =
7 SP_ARTICLES =
9 MAN1_TXT += $(filter-out \
10 $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
11 $(wildcard git-*.txt))
12 MAN1_TXT += git.txt
13 MAN1_TXT += gitk.txt
14 MAN1_TXT += gitremote-helpers.txt
15 MAN1_TXT += gitweb.txt
17 MAN5_TXT += gitattributes.txt
18 MAN5_TXT += githooks.txt
19 MAN5_TXT += gitignore.txt
20 MAN5_TXT += gitmodules.txt
21 MAN5_TXT += gitrepository-layout.txt
22 MAN5_TXT += gitweb.conf.txt
24 MAN7_TXT += gitcli.txt
25 MAN7_TXT += gitcore-tutorial.txt
26 MAN7_TXT += gitcredentials.txt
27 MAN7_TXT += gitcvs-migration.txt
28 MAN7_TXT += gitdiffcore.txt
29 MAN7_TXT += gitglossary.txt
30 MAN7_TXT += gitnamespaces.txt
31 MAN7_TXT += gitrevisions.txt
32 MAN7_TXT += gittutorial-2.txt
33 MAN7_TXT += gittutorial.txt
34 MAN7_TXT += gitworkflows.txt
36 MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
37 MAN_XML = $(patsubst %.txt,%.xml,$(MAN_TXT))
38 MAN_HTML = $(patsubst %.txt,%.html,$(MAN_TXT))
40 OBSOLETE_HTML = git-remote-helpers.html
41 DOC_HTML = $(MAN_HTML) $(OBSOLETE_HTML)
43 ARTICLES += howto-index
44 ARTICLES += everyday
45 ARTICLES += git-tools
46 ARTICLES += git-bisect-lk2009
47 # with their own formatting rules.
48 SP_ARTICLES += user-manual
49 SP_ARTICLES += howto/new-command
50 SP_ARTICLES += howto/revert-branch-rebase
51 SP_ARTICLES += howto/using-merge-subtree
52 SP_ARTICLES += howto/using-signed-tag-in-pull-request
53 SP_ARTICLES += howto/use-git-daemon
54 SP_ARTICLES += howto/update-hook-example
55 SP_ARTICLES += howto/setup-git-server-over-http
56 SP_ARTICLES += howto/separating-topic-branches
57 SP_ARTICLES += howto/revert-a-faulty-merge
58 SP_ARTICLES += howto/recover-corrupted-blob-object
59 SP_ARTICLES += howto/recover-corrupted-object-harder
60 SP_ARTICLES += howto/rebuild-from-update-hook
61 SP_ARTICLES += howto/rebase-from-internal-branch
62 SP_ARTICLES += howto/maintain-git
63 API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
64 SP_ARTICLES += $(API_DOCS)
66 TECH_DOCS += technical/http-protocol
67 TECH_DOCS += technical/index-format
68 TECH_DOCS += technical/pack-format
69 TECH_DOCS += technical/pack-heuristics
70 TECH_DOCS += technical/pack-protocol
71 TECH_DOCS += technical/protocol-capabilities
72 TECH_DOCS += technical/protocol-common
73 TECH_DOCS += technical/racy-git
74 TECH_DOCS += technical/send-pack-pipeline
75 TECH_DOCS += technical/shallow
76 TECH_DOCS += technical/trivial-merge
77 SP_ARTICLES += $(TECH_DOCS)
78 SP_ARTICLES += technical/api-index
80 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
82 DOC_MAN1 = $(patsubst %.txt,%.1,$(MAN1_TXT))
83 DOC_MAN5 = $(patsubst %.txt,%.5,$(MAN5_TXT))
84 DOC_MAN7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
86 prefix ?= $(HOME)
87 bindir ?= $(prefix)/bin
88 htmldir ?= $(prefix)/share/doc/git-doc
89 infodir ?= $(prefix)/share/info
90 pdfdir ?= $(prefix)/share/doc/git-doc
91 mandir ?= $(prefix)/share/man
92 man1dir = $(mandir)/man1
93 man5dir = $(mandir)/man5
94 man7dir = $(mandir)/man7
95 # DESTDIR =
97 ASCIIDOC = asciidoc
98 ASCIIDOC_EXTRA =
99 MANPAGE_XSL = manpage-normal.xsl
100 XMLTO = xmlto
101 XMLTO_EXTRA =
102 INSTALL ?= install
103 RM ?= rm -f
104 MAN_REPO = ../../git-manpages
105 HTML_REPO = ../../git-htmldocs
107 MAKEINFO = makeinfo
108 INSTALL_INFO = install-info
109 DOCBOOK2X_TEXI = docbook2x-texi
110 DBLATEX = dblatex
111 ASCIIDOC_DBLATEX_DIR = /etc/asciidoc/dblatex
112 ifndef PERL_PATH
113 PERL_PATH = /usr/bin/perl
114 endif
116 -include ../config.mak.autogen
117 -include ../config.mak
120 # For docbook-xsl ...
121 # -1.68.1, no extra settings are needed?
122 # 1.69.0, set ASCIIDOC_ROFF?
123 # 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
124 # 1.71.1, set ASCIIDOC_ROFF?
125 # 1.72.0, set DOCBOOK_XSL_172.
126 # 1.73.0-, no extra settings are needed
129 ifdef DOCBOOK_XSL_172
130 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
131 MANPAGE_XSL = manpage-1.72.xsl
132 else
133 ifndef ASCIIDOC_ROFF
134 # docbook-xsl after 1.72 needs the regular XSL, but will not
135 # pass-thru raw roff codes from asciidoc.conf, so turn them off.
136 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
137 endif
138 endif
139 ifdef MAN_BOLD_LITERAL
140 XMLTO_EXTRA += -m manpage-bold-literal.xsl
141 endif
142 ifdef DOCBOOK_SUPPRESS_SP
143 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
144 endif
146 # Newer DocBook stylesheet emits warning cruft in the output when
147 # this is not set, and if set it shows an absolute link. Older
148 # stylesheets simply ignore this parameter.
150 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
151 # or similar.
152 ifndef MAN_BASE_URL
153 MAN_BASE_URL = file://$(htmldir)/
154 endif
155 XMLTO_EXTRA += -m manpage-base-url.xsl
157 # If your target system uses GNU groff, it may try to render
158 # apostrophes as a "pretty" apostrophe using unicode. This breaks
159 # cut&paste, so you should set GNU_ROFF to force them to be ASCII
160 # apostrophes. Unfortunately does not work with non-GNU roff.
161 ifdef GNU_ROFF
162 XMLTO_EXTRA += -m manpage-quote-apos.xsl
163 endif
165 SHELL_PATH ?= $(SHELL)
166 # Shell quote;
167 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
169 ifdef DEFAULT_PAGER
170 DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
171 ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
172 endif
174 ifdef DEFAULT_EDITOR
175 DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
176 ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
177 endif
179 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
180 QUIET_SUBDIR1 =
182 ifneq ($(findstring $(MAKEFLAGS),w),w)
183 PRINT_DIR = --no-print-directory
184 else # "make -w"
185 NO_SUBDIR = :
186 endif
188 ifneq ($(findstring $(MAKEFLAGS),s),s)
189 ifndef V
190 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
191 QUIET_XMLTO = @echo ' ' XMLTO $@;
192 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
193 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
194 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
195 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
196 QUIET_GEN = @echo ' ' GEN $@;
197 QUIET_STDERR = 2> /dev/null
198 QUIET_SUBDIR0 = +@subdir=
199 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
200 $(MAKE) $(PRINT_DIR) -C $$subdir
201 export V
202 endif
203 endif
205 all: html man
207 html: $(DOC_HTML)
209 man: man1 man5 man7
210 man1: $(DOC_MAN1)
211 man5: $(DOC_MAN5)
212 man7: $(DOC_MAN7)
214 info: git.info gitman.info
216 pdf: user-manual.pdf
218 install: install-man
220 install-man: man
221 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
222 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
223 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
224 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
225 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
226 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
228 install-info: info
229 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
230 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
231 if test -r $(DESTDIR)$(infodir)/dir; then \
232 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
233 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
234 else \
235 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
238 install-pdf: pdf
239 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
240 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
242 install-html: html
243 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
245 ../GIT-VERSION-FILE: FORCE
246 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
248 -include ../GIT-VERSION-FILE
251 # Determine "include::" file references in asciidoc files.
253 docdep_prereqs = \
254 mergetools-list.made $(mergetools_txt) \
255 cmd-list.made $(cmds_txt)
257 doc.dep : $(docdep_prereqs) $(wildcard *.txt) build-docdep.perl
258 $(QUIET_GEN)$(RM) $@+ $@ && \
259 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
260 mv $@+ $@
262 -include doc.dep
264 cmds_txt = cmds-ancillaryinterrogators.txt \
265 cmds-ancillarymanipulators.txt \
266 cmds-mainporcelain.txt \
267 cmds-plumbinginterrogators.txt \
268 cmds-plumbingmanipulators.txt \
269 cmds-synchingrepositories.txt \
270 cmds-synchelpers.txt \
271 cmds-purehelpers.txt \
272 cmds-foreignscminterface.txt
274 $(cmds_txt): cmd-list.made
276 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
277 $(QUIET_GEN)$(RM) $@ && \
278 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
279 date >$@
281 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
283 $(mergetools_txt): mergetools-list.made
285 mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
286 $(QUIET_GEN)$(RM) $@ && \
287 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
288 . ../git-mergetool--lib.sh && \
289 show_tool_names can_diff "* " || :' >mergetools-diff.txt && \
290 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
291 . ../git-mergetool--lib.sh && \
292 show_tool_names can_merge "* " || :' >mergetools-merge.txt && \
293 date >$@
295 clean:
296 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
297 $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
298 $(RM) *.pdf
299 $(RM) howto-index.txt howto/*.html doc.dep
300 $(RM) technical/*.html technical/api-index.txt
301 $(RM) $(cmds_txt) $(mergetools_txt) *.made
302 $(RM) manpage-base-url.xsl
304 $(MAN_HTML): %.html : %.txt asciidoc.conf
305 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
306 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
307 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
308 mv $@+ $@
310 $(OBSOLETE_HTML): %.html : %.txto asciidoc.conf
311 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
312 $(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
313 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
314 mv $@+ $@
316 manpage-base-url.xsl: manpage-base-url.xsl.in
317 sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
319 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
320 $(QUIET_XMLTO)$(RM) $@ && \
321 $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
323 %.xml : %.txt asciidoc.conf
324 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
325 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
326 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
327 mv $@+ $@
329 user-manual.xml: user-manual.txt user-manual.conf
330 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
331 $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d article -o $@+ $< && \
332 mv $@+ $@
334 technical/api-index.txt: technical/api-index-skel.txt \
335 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
336 $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
338 technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
339 $(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt asciidoc.conf
340 $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
341 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
343 XSLT = docbook.xsl
344 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
346 user-manual.html: user-manual.xml $(XSLT)
347 $(QUIET_XSLTPROC)$(RM) $@+ $@ && \
348 xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
349 mv $@+ $@
351 git.info: user-manual.texi
352 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
354 user-manual.texi: user-manual.xml
355 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
356 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
357 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
358 rm $@++ && \
359 mv $@+ $@
361 user-manual.pdf: user-manual.xml
362 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
363 $(DBLATEX) -o $@+ -p $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.xsl -s $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.sty $< && \
364 mv $@+ $@
366 gitman.texi: $(MAN_XML) cat-texi.perl
367 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
368 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
369 --to-stdout $(xml) &&) true) > $@++ && \
370 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
371 rm $@++ && \
372 mv $@+ $@
374 gitman.info: gitman.texi
375 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
377 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
378 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
379 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
380 mv $@+ $@
382 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
383 $(QUIET_GEN)$(RM) $@+ $@ && \
384 '$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(wildcard howto/*.txt)) >$@+ && \
385 mv $@+ $@
387 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
388 $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 $*.txt
390 WEBDOC_DEST = /pub/software/scm/git/docs
392 howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
393 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
394 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
395 sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \
396 mv $@+ $@
398 install-webdoc : html
399 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
401 # You must have a clone of 'git-htmldocs' and 'git-manpages' repositories
402 # next to the 'git' repository itself for the following to work.
404 quick-install: quick-install-man
406 require-manrepo::
407 @if test ! -d $(MAN_REPO); \
408 then echo "git-manpages repository must exist at $(MAN_REPO)"; exit 1; fi
410 quick-install-man: require-manrepo
411 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(MAN_REPO) $(DESTDIR)$(mandir)
413 require-htmlrepo::
414 @if test ! -d $(HTML_REPO); \
415 then echo "git-htmldocs repository must exist at $(HTML_REPO)"; exit 1; fi
417 quick-install-html: require-htmlrepo
418 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(htmldir)
420 print-man1:
421 @for i in $(MAN1_TXT); do echo $$i; done
423 .PHONY: FORCE