Documentation: use preferred name for the 'todo list' script
[git.git] / Documentation / Makefile
blob2ab65561af628820f862a48ac05246cc9e773ee8
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 += SubmittingPatches
71 TECH_DOCS += technical/hash-function-transition
72 TECH_DOCS += technical/http-protocol
73 TECH_DOCS += technical/index-format
74 TECH_DOCS += technical/pack-format
75 TECH_DOCS += technical/pack-heuristics
76 TECH_DOCS += technical/pack-protocol
77 TECH_DOCS += technical/protocol-capabilities
78 TECH_DOCS += technical/protocol-common
79 TECH_DOCS += technical/racy-git
80 TECH_DOCS += technical/send-pack-pipeline
81 TECH_DOCS += technical/shallow
82 TECH_DOCS += technical/signature-format
83 TECH_DOCS += technical/trivial-merge
84 SP_ARTICLES += $(TECH_DOCS)
85 SP_ARTICLES += technical/api-index
87 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
89 DOC_MAN1 = $(patsubst %.txt,%.1,$(MAN1_TXT))
90 DOC_MAN5 = $(patsubst %.txt,%.5,$(MAN5_TXT))
91 DOC_MAN7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
93 prefix ?= $(HOME)
94 bindir ?= $(prefix)/bin
95 htmldir ?= $(prefix)/share/doc/git-doc
96 infodir ?= $(prefix)/share/info
97 pdfdir ?= $(prefix)/share/doc/git-doc
98 mandir ?= $(prefix)/share/man
99 man1dir = $(mandir)/man1
100 man5dir = $(mandir)/man5
101 man7dir = $(mandir)/man7
102 # DESTDIR =
104 ASCIIDOC = asciidoc
105 ASCIIDOC_EXTRA =
106 ASCIIDOC_HTML = xhtml11
107 ASCIIDOC_DOCBOOK = docbook
108 ASCIIDOC_CONF = -f asciidoc.conf
109 ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
110 -agit_version=$(GIT_VERSION)
111 TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
112 TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
113 MANPAGE_XSL = manpage-normal.xsl
114 XMLTO = xmlto
115 XMLTO_EXTRA =
116 INSTALL ?= install
117 RM ?= rm -f
118 MAN_REPO = ../../git-manpages
119 HTML_REPO = ../../git-htmldocs
121 MAKEINFO = makeinfo
122 INSTALL_INFO = install-info
123 DOCBOOK2X_TEXI = docbook2x-texi
124 DBLATEX = dblatex
125 ASCIIDOC_DBLATEX_DIR = /etc/asciidoc/dblatex
126 DBLATEX_COMMON = -p $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.xsl -s $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.sty
127 ifndef PERL_PATH
128 PERL_PATH = /usr/bin/perl
129 endif
131 -include ../config.mak.autogen
132 -include ../config.mak
135 # For docbook-xsl ...
136 # -1.68.1, no extra settings are needed?
137 # 1.69.0, set ASCIIDOC_ROFF?
138 # 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
139 # 1.71.1, set ASCIIDOC_ROFF?
140 # 1.72.0, set DOCBOOK_XSL_172.
141 # 1.73.0-, no extra settings are needed
144 ifdef DOCBOOK_XSL_172
145 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
146 MANPAGE_XSL = manpage-1.72.xsl
147 else
148 ifndef ASCIIDOC_ROFF
149 # docbook-xsl after 1.72 needs the regular XSL, but will not
150 # pass-thru raw roff codes from asciidoc.conf, so turn them off.
151 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
152 endif
153 endif
154 ifndef NO_MAN_BOLD_LITERAL
155 XMLTO_EXTRA += -m manpage-bold-literal.xsl
156 endif
157 ifdef DOCBOOK_SUPPRESS_SP
158 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
159 endif
161 # Newer DocBook stylesheet emits warning cruft in the output when
162 # this is not set, and if set it shows an absolute link. Older
163 # stylesheets simply ignore this parameter.
165 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
166 # or similar.
167 ifndef MAN_BASE_URL
168 MAN_BASE_URL = file://$(htmldir)/
169 endif
170 XMLTO_EXTRA += -m manpage-base-url.xsl
172 # If your target system uses GNU groff, it may try to render
173 # apostrophes as a "pretty" apostrophe using unicode. This breaks
174 # cut&paste, so you should set GNU_ROFF to force them to be ASCII
175 # apostrophes. Unfortunately does not work with non-GNU roff.
176 ifdef GNU_ROFF
177 XMLTO_EXTRA += -m manpage-quote-apos.xsl
178 endif
180 ifdef USE_ASCIIDOCTOR
181 ASCIIDOC = asciidoctor
182 ASCIIDOC_CONF =
183 ASCIIDOC_HTML = xhtml5
184 ASCIIDOC_DOCBOOK = docbook45
185 ASCIIDOC_EXTRA += -acompat-mode
186 ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
187 ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
188 DBLATEX_COMMON =
189 endif
191 SHELL_PATH ?= $(SHELL)
192 # Shell quote;
193 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
195 ifdef DEFAULT_PAGER
196 DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
197 ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
198 endif
200 ifdef DEFAULT_EDITOR
201 DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
202 ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
203 endif
205 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
206 QUIET_SUBDIR1 =
208 ifneq ($(findstring $(MAKEFLAGS),w),w)
209 PRINT_DIR = --no-print-directory
210 else # "make -w"
211 NO_SUBDIR = :
212 endif
214 ifneq ($(findstring $(MAKEFLAGS),s),s)
215 ifndef V
216 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
217 QUIET_XMLTO = @echo ' ' XMLTO $@;
218 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
219 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
220 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
221 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
222 QUIET_GEN = @echo ' ' GEN $@;
223 QUIET_LINT = @echo ' ' LINT $@;
224 QUIET_STDERR = 2> /dev/null
225 QUIET_SUBDIR0 = +@subdir=
226 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
227 $(MAKE) $(PRINT_DIR) -C $$subdir
228 export V
229 endif
230 endif
232 all: html man
234 html: $(DOC_HTML)
236 man: man1 man5 man7
237 man1: $(DOC_MAN1)
238 man5: $(DOC_MAN5)
239 man7: $(DOC_MAN7)
241 info: git.info gitman.info
243 pdf: user-manual.pdf
245 install: install-man
247 install-man: man
248 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
249 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
250 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
251 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
252 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
253 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
255 install-info: info
256 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
257 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
258 if test -r $(DESTDIR)$(infodir)/dir; then \
259 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
260 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
261 else \
262 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
265 install-pdf: pdf
266 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
267 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
269 install-html: html
270 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
272 ../GIT-VERSION-FILE: FORCE
273 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
275 -include ../GIT-VERSION-FILE
278 # Determine "include::" file references in asciidoc files.
280 docdep_prereqs = \
281 mergetools-list.made $(mergetools_txt) \
282 cmd-list.made $(cmds_txt)
284 doc.dep : $(docdep_prereqs) $(wildcard *.txt) build-docdep.perl
285 $(QUIET_GEN)$(RM) $@+ $@ && \
286 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
287 mv $@+ $@
289 -include doc.dep
291 cmds_txt = cmds-ancillaryinterrogators.txt \
292 cmds-ancillarymanipulators.txt \
293 cmds-mainporcelain.txt \
294 cmds-plumbinginterrogators.txt \
295 cmds-plumbingmanipulators.txt \
296 cmds-synchingrepositories.txt \
297 cmds-synchelpers.txt \
298 cmds-purehelpers.txt \
299 cmds-foreignscminterface.txt
301 $(cmds_txt): cmd-list.made
303 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
304 $(QUIET_GEN)$(RM) $@ && \
305 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
306 date >$@
308 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
310 $(mergetools_txt): mergetools-list.made
312 mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
313 $(QUIET_GEN)$(RM) $@ && \
314 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
315 . ../git-mergetool--lib.sh && \
316 show_tool_names can_diff "* " || :' >mergetools-diff.txt && \
317 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
318 . ../git-mergetool--lib.sh && \
319 show_tool_names can_merge "* " || :' >mergetools-merge.txt && \
320 date >$@
322 clean:
323 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
324 $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
325 $(RM) *.pdf
326 $(RM) howto-index.txt howto/*.html doc.dep
327 $(RM) technical/*.html technical/api-index.txt
328 $(RM) SubmittingPatches.txt
329 $(RM) $(cmds_txt) $(mergetools_txt) *.made
330 $(RM) manpage-base-url.xsl
332 $(MAN_HTML): %.html : %.txt asciidoc.conf
333 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
334 $(TXT_TO_HTML) -d manpage -o $@+ $< && \
335 mv $@+ $@
337 $(OBSOLETE_HTML): %.html : %.txto asciidoc.conf
338 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
339 $(TXT_TO_HTML) -o $@+ $< && \
340 mv $@+ $@
342 manpage-base-url.xsl: manpage-base-url.xsl.in
343 sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
345 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
346 $(QUIET_XMLTO)$(RM) $@ && \
347 $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
349 %.xml : %.txt asciidoc.conf
350 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
351 $(TXT_TO_XML) -d manpage -o $@+ $< && \
352 mv $@+ $@
354 user-manual.xml: user-manual.txt user-manual.conf
355 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
356 $(TXT_TO_XML) -d book -o $@+ $< && \
357 mv $@+ $@
359 technical/api-index.txt: technical/api-index-skel.txt \
360 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
361 $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
363 technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
364 $(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt asciidoc.conf
365 $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
367 SubmittingPatches.txt: SubmittingPatches
368 $(QUIET_GEN) cp $< $@
370 XSLT = docbook.xsl
371 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
373 user-manual.html: user-manual.xml $(XSLT)
374 $(QUIET_XSLTPROC)$(RM) $@+ $@ && \
375 xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
376 mv $@+ $@
378 git.info: user-manual.texi
379 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
381 user-manual.texi: user-manual.xml
382 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
383 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
384 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
385 rm $@++ && \
386 mv $@+ $@
388 user-manual.pdf: user-manual.xml
389 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
390 $(DBLATEX) -o $@+ $(DBLATEX_COMMON) $< && \
391 mv $@+ $@
393 gitman.texi: $(MAN_XML) cat-texi.perl texi.xsl
394 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
395 ($(foreach xml,$(sort $(MAN_XML)),xsltproc -o $(xml)+ texi.xsl $(xml) && \
396 $(DOCBOOK2X_TEXI) --encoding=UTF-8 --to-stdout $(xml)+ && \
397 rm $(xml)+ &&) true) > $@++ && \
398 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
399 rm $@++ && \
400 mv $@+ $@
402 gitman.info: gitman.texi
403 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
405 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
406 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
407 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
408 mv $@+ $@
410 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
411 $(QUIET_GEN)$(RM) $@+ $@ && \
412 '$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(wildcard howto/*.txt)) >$@+ && \
413 mv $@+ $@
415 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
416 $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
418 WEBDOC_DEST = /pub/software/scm/git/docs
420 howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
421 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
422 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
423 sed -e '1,/^$$/d' $< | \
424 $(TXT_TO_HTML) - >$@+ && \
425 mv $@+ $@
427 install-webdoc : html
428 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
430 # You must have a clone of 'git-htmldocs' and 'git-manpages' repositories
431 # next to the 'git' repository itself for the following to work.
433 quick-install: quick-install-man
435 require-manrepo::
436 @if test ! -d $(MAN_REPO); \
437 then echo "git-manpages repository must exist at $(MAN_REPO)"; exit 1; fi
439 quick-install-man: require-manrepo
440 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(MAN_REPO) $(DESTDIR)$(mandir)
442 require-htmlrepo::
443 @if test ! -d $(HTML_REPO); \
444 then echo "git-htmldocs repository must exist at $(HTML_REPO)"; exit 1; fi
446 quick-install-html: require-htmlrepo
447 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(htmldir)
449 print-man1:
450 @for i in $(MAN1_TXT); do echo $$i; done
452 lint-docs::
453 $(QUIET_LINT)$(PERL_PATH) lint-gitlink.perl
455 .PHONY: FORCE