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