Skip tests that fail due to incomplete implementations, missing tools...
[git/mingw/j6t.git] / Documentation / Makefile
blob3e39e2815baca82fe5f1fff8791de37c3c7247ac
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 += gittutorial-2.txt
35 MAN7_TXT += gittutorial.txt
36 MAN7_TXT += gitworkflows.txt
38 MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
39 MAN_XML = $(patsubst %.txt,%.xml,$(MAN_TXT))
40 MAN_HTML = $(patsubst %.txt,%.html,$(MAN_TXT))
42 OBSOLETE_HTML += everyday.html
43 OBSOLETE_HTML += git-remote-helpers.html
44 DOC_HTML = $(MAN_HTML) $(OBSOLETE_HTML)
46 ARTICLES += howto-index
47 ARTICLES += git-tools
48 ARTICLES += git-bisect-lk2009
49 # with their own formatting rules.
50 SP_ARTICLES += user-manual
51 SP_ARTICLES += howto/new-command
52 SP_ARTICLES += howto/revert-branch-rebase
53 SP_ARTICLES += howto/using-merge-subtree
54 SP_ARTICLES += howto/using-signed-tag-in-pull-request
55 SP_ARTICLES += howto/use-git-daemon
56 SP_ARTICLES += howto/update-hook-example
57 SP_ARTICLES += howto/setup-git-server-over-http
58 SP_ARTICLES += howto/separating-topic-branches
59 SP_ARTICLES += howto/revert-a-faulty-merge
60 SP_ARTICLES += howto/recover-corrupted-blob-object
61 SP_ARTICLES += howto/recover-corrupted-object-harder
62 SP_ARTICLES += howto/rebuild-from-update-hook
63 SP_ARTICLES += howto/rebase-from-internal-branch
64 SP_ARTICLES += howto/keep-canonical-history-correct
65 SP_ARTICLES += howto/maintain-git
66 API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
67 SP_ARTICLES += $(API_DOCS)
69 TECH_DOCS += technical/http-protocol
70 TECH_DOCS += technical/index-format
71 TECH_DOCS += technical/pack-format
72 TECH_DOCS += technical/pack-heuristics
73 TECH_DOCS += technical/pack-protocol
74 TECH_DOCS += technical/protocol-capabilities
75 TECH_DOCS += technical/protocol-common
76 TECH_DOCS += technical/racy-git
77 TECH_DOCS += technical/send-pack-pipeline
78 TECH_DOCS += technical/shallow
79 TECH_DOCS += technical/trivial-merge
80 SP_ARTICLES += $(TECH_DOCS)
81 SP_ARTICLES += technical/api-index
83 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
85 DOC_MAN1 = $(patsubst %.txt,%.1,$(MAN1_TXT))
86 DOC_MAN5 = $(patsubst %.txt,%.5,$(MAN5_TXT))
87 DOC_MAN7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
89 prefix ?= $(HOME)
90 bindir ?= $(prefix)/bin
91 htmldir ?= $(prefix)/share/doc/git-doc
92 infodir ?= $(prefix)/share/info
93 pdfdir ?= $(prefix)/share/doc/git-doc
94 mandir ?= $(prefix)/share/man
95 man1dir = $(mandir)/man1
96 man5dir = $(mandir)/man5
97 man7dir = $(mandir)/man7
98 # DESTDIR =
100 ASCIIDOC = asciidoc
101 ASCIIDOC_EXTRA =
102 ASCIIDOC_HTML = xhtml11
103 ASCIIDOC_DOCBOOK = docbook
104 ASCIIDOC_CONF = -f asciidoc.conf
105 ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
106 -agit_version=$(GIT_VERSION)
107 TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
108 TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
109 MANPAGE_XSL = manpage-normal.xsl
110 XMLTO = xmlto
111 XMLTO_EXTRA =
112 INSTALL ?= install
113 RM ?= rm -f
114 MAN_REPO = ../../git-manpages
115 HTML_REPO = ../../git-htmldocs
117 MAKEINFO = makeinfo
118 INSTALL_INFO = install-info
119 DOCBOOK2X_TEXI = docbook2x-texi
120 DBLATEX = dblatex
121 ASCIIDOC_DBLATEX_DIR = /etc/asciidoc/dblatex
122 ifndef PERL_PATH
123 PERL_PATH = /usr/bin/perl
124 endif
126 -include ../config.mak.autogen
127 -include ../config.mak
130 # For docbook-xsl ...
131 # -1.68.1, no extra settings are needed?
132 # 1.69.0, set ASCIIDOC_ROFF?
133 # 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
134 # 1.71.1, set ASCIIDOC_ROFF?
135 # 1.72.0, set DOCBOOK_XSL_172.
136 # 1.73.0-, no extra settings are needed
139 ifdef DOCBOOK_XSL_172
140 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
141 MANPAGE_XSL = manpage-1.72.xsl
142 else
143 ifndef ASCIIDOC_ROFF
144 # docbook-xsl after 1.72 needs the regular XSL, but will not
145 # pass-thru raw roff codes from asciidoc.conf, so turn them off.
146 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
147 endif
148 endif
149 ifdef MAN_BOLD_LITERAL
150 XMLTO_EXTRA += -m manpage-bold-literal.xsl
151 endif
152 ifdef DOCBOOK_SUPPRESS_SP
153 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
154 endif
156 # Newer DocBook stylesheet emits warning cruft in the output when
157 # this is not set, and if set it shows an absolute link. Older
158 # stylesheets simply ignore this parameter.
160 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
161 # or similar.
162 ifndef MAN_BASE_URL
163 MAN_BASE_URL = file://$(htmldir)/
164 endif
165 XMLTO_EXTRA += -m manpage-base-url.xsl
167 # If your target system uses GNU groff, it may try to render
168 # apostrophes as a "pretty" apostrophe using unicode. This breaks
169 # cut&paste, so you should set GNU_ROFF to force them to be ASCII
170 # apostrophes. Unfortunately does not work with non-GNU roff.
171 ifdef GNU_ROFF
172 XMLTO_EXTRA += -m manpage-quote-apos.xsl
173 endif
175 SHELL_PATH ?= $(SHELL)
176 # Shell quote;
177 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
179 ifdef DEFAULT_PAGER
180 DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
181 ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
182 endif
184 ifdef DEFAULT_EDITOR
185 DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
186 ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
187 endif
189 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
190 QUIET_SUBDIR1 =
192 ifneq ($(findstring $(MAKEFLAGS),w),w)
193 PRINT_DIR = --no-print-directory
194 else # "make -w"
195 NO_SUBDIR = :
196 endif
198 ifneq ($(findstring $(MAKEFLAGS),s),s)
199 ifndef V
200 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
201 QUIET_XMLTO = @echo ' ' XMLTO $@;
202 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
203 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
204 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
205 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
206 QUIET_GEN = @echo ' ' GEN $@;
207 QUIET_STDERR = 2> /dev/null
208 QUIET_SUBDIR0 = +@subdir=
209 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
210 $(MAKE) $(PRINT_DIR) -C $$subdir
211 export V
212 endif
213 endif
215 all: html man
217 html: $(DOC_HTML)
219 man: man1 man5 man7
220 man1: $(DOC_MAN1)
221 man5: $(DOC_MAN5)
222 man7: $(DOC_MAN7)
224 info: git.info gitman.info
226 pdf: user-manual.pdf
228 install: install-man
230 install-man: man
231 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
232 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
233 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
234 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
235 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
236 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
238 install-info: info
239 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
240 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
241 if test -r $(DESTDIR)$(infodir)/dir; then \
242 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
243 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
244 else \
245 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
248 install-pdf: pdf
249 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
250 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
252 install-html: html
253 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
255 ../GIT-VERSION-FILE: FORCE
256 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
258 -include ../GIT-VERSION-FILE
261 # Determine "include::" file references in asciidoc files.
263 docdep_prereqs = \
264 mergetools-list.made $(mergetools_txt) \
265 cmd-list.made $(cmds_txt)
267 doc.dep : $(docdep_prereqs) $(wildcard *.txt) build-docdep.perl
268 $(QUIET_GEN)$(RM) $@+ $@ && \
269 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
270 mv $@+ $@
272 -include doc.dep
274 cmds_txt = cmds-ancillaryinterrogators.txt \
275 cmds-ancillarymanipulators.txt \
276 cmds-mainporcelain.txt \
277 cmds-plumbinginterrogators.txt \
278 cmds-plumbingmanipulators.txt \
279 cmds-synchingrepositories.txt \
280 cmds-synchelpers.txt \
281 cmds-purehelpers.txt \
282 cmds-foreignscminterface.txt
284 $(cmds_txt): cmd-list.made
286 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
287 $(QUIET_GEN)$(RM) $@ && \
288 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
289 date >$@
291 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
293 $(mergetools_txt): mergetools-list.made
295 mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
296 $(QUIET_GEN)$(RM) $@ && \
297 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
298 . ../git-mergetool--lib.sh && \
299 show_tool_names can_diff "* " || :' >mergetools-diff.txt && \
300 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
301 . ../git-mergetool--lib.sh && \
302 show_tool_names can_merge "* " || :' >mergetools-merge.txt && \
303 date >$@
305 clean:
306 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
307 $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
308 $(RM) *.pdf
309 $(RM) howto-index.txt howto/*.html doc.dep
310 $(RM) technical/*.html technical/api-index.txt
311 $(RM) $(cmds_txt) $(mergetools_txt) *.made
312 $(RM) manpage-base-url.xsl
314 $(MAN_HTML): %.html : %.txt asciidoc.conf
315 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
316 $(TXT_TO_HTML) -d manpage -o $@+ $< && \
317 mv $@+ $@
319 $(OBSOLETE_HTML): %.html : %.txto asciidoc.conf
320 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
321 $(TXT_TO_HTML) -o $@+ $< && \
322 mv $@+ $@
324 manpage-base-url.xsl: manpage-base-url.xsl.in
325 sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
327 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
328 $(QUIET_XMLTO)$(RM) $@ && \
329 $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
331 %.xml : %.txt asciidoc.conf
332 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
333 $(TXT_TO_XML) -d manpage -o $@+ $< && \
334 mv $@+ $@
336 user-manual.xml: user-manual.txt user-manual.conf
337 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
338 $(TXT_TO_XML) -d article -o $@+ $< && \
339 mv $@+ $@
341 technical/api-index.txt: technical/api-index-skel.txt \
342 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
343 $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
345 technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
346 $(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt asciidoc.conf
347 $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
349 XSLT = docbook.xsl
350 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
352 user-manual.html: user-manual.xml $(XSLT)
353 $(QUIET_XSLTPROC)$(RM) $@+ $@ && \
354 xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
355 mv $@+ $@
357 git.info: user-manual.texi
358 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
360 user-manual.texi: user-manual.xml
361 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
362 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
363 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
364 rm $@++ && \
365 mv $@+ $@
367 user-manual.pdf: user-manual.xml
368 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
369 $(DBLATEX) -o $@+ -p $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.xsl -s $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.sty $< && \
370 mv $@+ $@
372 gitman.texi: $(MAN_XML) cat-texi.perl
373 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
374 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
375 --to-stdout $(xml) &&) true) > $@++ && \
376 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
377 rm $@++ && \
378 mv $@+ $@
380 gitman.info: gitman.texi
381 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
383 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
384 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
385 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
386 mv $@+ $@
388 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
389 $(QUIET_GEN)$(RM) $@+ $@ && \
390 '$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(wildcard howto/*.txt)) >$@+ && \
391 mv $@+ $@
393 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
394 $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
396 WEBDOC_DEST = /pub/software/scm/git/docs
398 howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
399 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
400 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
401 sed -e '1,/^$$/d' $< | \
402 $(TXT_TO_HTML) - >$@+ && \
403 mv $@+ $@
405 install-webdoc : html
406 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
408 # You must have a clone of 'git-htmldocs' and 'git-manpages' repositories
409 # next to the 'git' repository itself for the following to work.
411 quick-install: quick-install-man
413 require-manrepo::
414 @if test ! -d $(MAN_REPO); \
415 then echo "git-manpages repository must exist at $(MAN_REPO)"; exit 1; fi
417 quick-install-man: require-manrepo
418 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(MAN_REPO) $(DESTDIR)$(mandir)
420 require-htmlrepo::
421 @if test ! -d $(HTML_REPO); \
422 then echo "git-htmldocs repository must exist at $(HTML_REPO)"; exit 1; fi
424 quick-install-html: require-htmlrepo
425 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(htmldir)
427 print-man1:
428 @for i in $(MAN1_TXT); do echo $$i; done
430 .PHONY: FORCE