1 # Import tree-wide shared Makefile behavior and libraries
4 # Guard against environment variables
15 -include GIT-EXCLUDED-PROGRAMS
17 MAN1_TXT
+= $(filter-out \
18 $(patsubst %,%.txt
,$(EXCLUDED_PROGRAMS
)) \
19 $(addsuffix .txt
, $(ARTICLES
) $(SP_ARTICLES
)), \
20 $(wildcard git-
*.txt
))
23 MAN1_TXT
+= gitweb.txt
25 # man5 / man7 guides (note: new guides should also be added to command-list.txt)
26 MAN5_TXT
+= gitattributes.txt
27 MAN5_TXT
+= githooks.txt
28 MAN5_TXT
+= gitignore.txt
29 MAN5_TXT
+= gitmailmap.txt
30 MAN5_TXT
+= gitmodules.txt
31 MAN5_TXT
+= gitrepository-layout.txt
32 MAN5_TXT
+= gitweb.conf.txt
34 MAN7_TXT
+= gitcli.txt
35 MAN7_TXT
+= gitcore-tutorial.txt
36 MAN7_TXT
+= gitcredentials.txt
37 MAN7_TXT
+= gitcvs-migration.txt
38 MAN7_TXT
+= gitdiffcore.txt
39 MAN7_TXT
+= giteveryday.txt
40 MAN7_TXT
+= gitfaq.txt
41 MAN7_TXT
+= gitglossary.txt
42 MAN7_TXT
+= gitnamespaces.txt
43 MAN7_TXT
+= gitremote-helpers.txt
44 MAN7_TXT
+= gitrevisions.txt
45 MAN7_TXT
+= gitsubmodules.txt
46 MAN7_TXT
+= gittutorial-2.txt
47 MAN7_TXT
+= gittutorial.txt
48 MAN7_TXT
+= gitworkflows.txt
50 HOWTO_TXT
+= $(wildcard howto
/*.txt
)
52 DOC_DEP_TXT
+= $(wildcard *.txt
)
53 DOC_DEP_TXT
+= $(wildcard config
/*.txt
)
56 MAN_TXT
= $(filter $(MAN_FILTER
),$(MAN1_TXT
) $(MAN5_TXT
) $(MAN7_TXT
))
58 MAN_TXT
= $(MAN1_TXT
) $(MAN5_TXT
) $(MAN7_TXT
)
59 MAN_FILTER
= $(MAN_TXT
)
62 MAN_XML
= $(patsubst %.txt
,%.xml
,$(MAN_TXT
))
63 MAN_HTML
= $(patsubst %.txt
,%.html
,$(MAN_TXT
))
66 OBSOLETE_HTML
+= everyday.html
67 OBSOLETE_HTML
+= git-remote-helpers.html
69 ARTICLES
+= howto-index
71 ARTICLES
+= git-bisect-lk2009
72 # with their own formatting rules.
73 SP_ARTICLES
+= user-manual
74 SP_ARTICLES
+= howto
/new-command
75 SP_ARTICLES
+= howto
/revert-branch-rebase
76 SP_ARTICLES
+= howto
/using-merge-subtree
77 SP_ARTICLES
+= howto
/using-signed-tag-in-pull-request
78 SP_ARTICLES
+= howto
/use-git-daemon
79 SP_ARTICLES
+= howto
/update-hook-example
80 SP_ARTICLES
+= howto
/setup-git-server-over-http
81 SP_ARTICLES
+= howto
/separating-topic-branches
82 SP_ARTICLES
+= howto
/revert-a-faulty-merge
83 SP_ARTICLES
+= howto
/recover-corrupted-blob-object
84 SP_ARTICLES
+= howto
/recover-corrupted-object-harder
85 SP_ARTICLES
+= howto
/rebuild-from-update-hook
86 SP_ARTICLES
+= howto
/rebase-from-internal-branch
87 SP_ARTICLES
+= howto
/keep-canonical-history-correct
88 SP_ARTICLES
+= howto
/maintain-git
89 SP_ARTICLES
+= howto
/coordinate-embargoed-releases
90 API_DOCS
= $(patsubst %.txt
,%,$(filter-out technical
/api-index-skel.txt technical
/api-index.txt
, $(wildcard technical
/api-
*.txt
)))
91 SP_ARTICLES
+= $(API_DOCS
)
93 TECH_DOCS
+= MyFirstContribution
94 TECH_DOCS
+= MyFirstObjectWalk
95 TECH_DOCS
+= SubmittingPatches
96 TECH_DOCS
+= technical
/bundle-format
97 TECH_DOCS
+= technical
/hash-function-transition
98 TECH_DOCS
+= technical
/http-protocol
99 TECH_DOCS
+= technical
/index-format
100 TECH_DOCS
+= technical
/long-running-process-protocol
101 TECH_DOCS
+= technical
/multi-pack-index
102 TECH_DOCS
+= technical
/pack-format
103 TECH_DOCS
+= technical
/pack-heuristics
104 TECH_DOCS
+= technical
/pack-protocol
105 TECH_DOCS
+= technical
/parallel-checkout
106 TECH_DOCS
+= technical
/partial-clone
107 TECH_DOCS
+= technical
/protocol-capabilities
108 TECH_DOCS
+= technical
/protocol-common
109 TECH_DOCS
+= technical
/protocol-v2
110 TECH_DOCS
+= technical
/racy-git
111 TECH_DOCS
+= technical
/reftable
112 TECH_DOCS
+= technical
/send-pack-pipeline
113 TECH_DOCS
+= technical
/shallow
114 TECH_DOCS
+= technical
/signature-format
115 TECH_DOCS
+= technical
/trivial-merge
116 SP_ARTICLES
+= $(TECH_DOCS
)
117 SP_ARTICLES
+= technical
/api-index
119 ARTICLES_HTML
+= $(patsubst %,%.html
,$(ARTICLES
) $(SP_ARTICLES
))
120 HTML_FILTER ?
= $(ARTICLES_HTML
) $(OBSOLETE_HTML
)
121 DOC_HTML
= $(MAN_HTML
) $(filter $(HTML_FILTER
),$(ARTICLES_HTML
) $(OBSOLETE_HTML
))
123 DOC_MAN1
= $(patsubst %.txt
,%.1,$(filter $(MAN_FILTER
),$(MAN1_TXT
)))
124 DOC_MAN5
= $(patsubst %.txt
,%.5,$(filter $(MAN_FILTER
),$(MAN5_TXT
)))
125 DOC_MAN7
= $(patsubst %.txt
,%.7,$(filter $(MAN_FILTER
),$(MAN7_TXT
)))
128 bindir ?
= $(prefix)/bin
129 htmldir ?
= $(prefix)/share
/doc
/git-doc
130 infodir ?
= $(prefix)/share
/info
131 pdfdir ?
= $(prefix)/share
/doc
/git-doc
132 mandir ?
= $(prefix)/share
/man
133 man1dir = $(mandir)/man1
134 man5dir = $(mandir)/man5
135 man7dir = $(mandir)/man7
140 ASCIIDOC_HTML
= xhtml11
141 ASCIIDOC_DOCBOOK
= docbook
142 ASCIIDOC_CONF
= -f asciidoc.conf
143 ASCIIDOC_COMMON
= $(ASCIIDOC
) $(ASCIIDOC_EXTRA
) $(ASCIIDOC_CONF
) \
144 -amanversion
=$(GIT_VERSION
) \
145 -amanmanual
='Git Manual' -amansource
='Git'
146 ASCIIDOC_DEPS
= asciidoc.conf GIT-ASCIIDOCFLAGS
147 TXT_TO_HTML
= $(ASCIIDOC_COMMON
) -b
$(ASCIIDOC_HTML
)
148 TXT_TO_XML
= $(ASCIIDOC_COMMON
) -b
$(ASCIIDOC_DOCBOOK
)
149 MANPAGE_XSL
= manpage-normal.xsl
154 MAN_REPO
= ..
/..
/git-manpages
155 HTML_REPO
= ..
/..
/git-htmldocs
158 INSTALL_INFO
= install-info
159 DOCBOOK2X_TEXI
= docbook2x-texi
161 ASCIIDOC_DBLATEX_DIR
= /etc
/asciidoc
/dblatex
162 DBLATEX_COMMON
= -p
$(ASCIIDOC_DBLATEX_DIR
)/asciidoc-dblatex.xsl
-s
$(ASCIIDOC_DBLATEX_DIR
)/asciidoc-dblatex.sty
164 PERL_PATH
= /usr
/bin
/perl
167 -include ..
/config.mak.autogen
168 -include ..
/config.mak
170 ifndef NO_MAN_BOLD_LITERAL
171 XMLTO_EXTRA
+= -m manpage-bold-literal.xsl
174 # Newer DocBook stylesheet emits warning cruft in the output when
175 # this is not set, and if set it shows an absolute link. Older
176 # stylesheets simply ignore this parameter.
178 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
181 MAN_BASE_URL
= file
://$(htmldir
)/
183 XMLTO_EXTRA
+= -m manpage-base-url.xsl
185 # If your target system uses GNU groff, it may try to render
186 # apostrophes as a "pretty" apostrophe using unicode. This breaks
187 # cut&paste, so you should set GNU_ROFF to force them to be ASCII
188 # apostrophes. Unfortunately does not work with non-GNU roff.
190 XMLTO_EXTRA
+= -m manpage-quote-apos.xsl
193 ifdef USE_ASCIIDOCTOR
194 ASCIIDOC
= asciidoctor
196 ASCIIDOC_HTML
= xhtml5
197 ASCIIDOC_DOCBOOK
= docbook5
198 ASCIIDOC_EXTRA
+= -acompat-mode
-atabsize
=8
199 ASCIIDOC_EXTRA
+= -I.
-rasciidoctor-extensions
200 ASCIIDOC_EXTRA
+= -alitdd
='&\#x2d;&\#x2d;'
201 ASCIIDOC_DEPS
= asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
203 XMLTO_EXTRA
+= --skip-validation
204 XMLTO_EXTRA
+= -x manpage.xsl
207 SHELL_PATH ?
= $(SHELL
)
209 SHELL_PATH_SQ
= $(subst ','\'',$(SHELL_PATH))
212 DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER
))
213 ASCIIDOC_EXTRA
+= -a
'git-default-pager=$(DEFAULT_PAGER_SQ)'
217 DEFAULT_EDITOR_SQ
= $(subst ','\'',$(DEFAULT_EDITOR))
218 ASCIIDOC_EXTRA += -a 'git-default-editor
=$(DEFAULT_EDITOR_SQ
)'
230 info: git.info gitman.info
237 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
238 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
239 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
240 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
241 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
242 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
245 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
246 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
247 if test -r $(DESTDIR)$(infodir)/dir; then \
248 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
249 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
251 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
255 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
256 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
259 '$(SHELL_PATH_SQ
)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
261 ../GIT-VERSION-FILE: FORCE
262 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
264 ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
265 -include ../GIT-VERSION-FILE
269 # Determine "include::" file references in asciidoc files.
272 mergetools-list.made $(mergetools_txt) \
273 cmd-list.made $(cmds_txt)
275 doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
276 $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
278 ifneq ($(MAKECMDGOALS),clean)
282 cmds_txt = cmds-ancillaryinterrogators.txt \
283 cmds-ancillarymanipulators.txt \
284 cmds-mainporcelain.txt \
285 cmds-plumbinginterrogators.txt \
286 cmds-plumbingmanipulators.txt \
287 cmds-synchingrepositories.txt \
288 cmds-synchelpers.txt \
290 cmds-purehelpers.txt \
291 cmds-foreignscminterface.txt
293 $(cmds_txt): cmd-list.made
295 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
296 $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
299 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
301 $(mergetools_txt): mergetools-list.made
303 mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
305 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR
=..
/mergetools
&& \
306 . ..
/git-mergetool--lib.sh
&& \
307 show_tool_names can_diff
"* " ||
:' >mergetools-diff.txt && \
308 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR
=..
/mergetools
&& \
309 . ..
/git-mergetool--lib.sh
&& \
310 show_tool_names can_merge
"* " ||
:' >mergetools-merge.txt && \
313 TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON
):$(ASCIIDOC_HTML
):$(ASCIIDOC_DOCBOOK
))
315 GIT-ASCIIDOCFLAGS
: FORCE
316 @FLAGS
='$(TRACK_ASCIIDOCFLAGS)'; \
317 if
test x
"$$FLAGS" != x
"`cat GIT-ASCIIDOCFLAGS 2>/dev/null`" ; then \
318 echo
>&2 " * new asciidoc flags"; \
319 echo
"$$FLAGS" >GIT-ASCIIDOCFLAGS
; \
324 $(RM
) *.xml
*.xml
+ *.html
*.html
+ *.1 *.5 *.7
325 $(RM
) *.texi
*.texi
+ *.texi
++ git.
info gitman.
info
327 $(RM
) howto-index.txt howto
/*.html doc.dep
328 $(RM
) technical
/*.html technical
/api-index.txt
329 $(RM
) SubmittingPatches.txt
330 $(RM
) $(cmds_txt
) $(mergetools_txt
) *.made
331 $(RM
) manpage-base-url.xsl
332 $(RM
) GIT-ASCIIDOCFLAGS
334 $(MAN_HTML
): %.html
: %.txt
$(ASCIIDOC_DEPS
)
335 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) -d manpage
-o
$@
$<
337 $(OBSOLETE_HTML
): %.html
: %.txto
$(ASCIIDOC_DEPS
)
338 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) -o
$@
$<
340 manpage-base-url.xsl
: manpage-base-url.xsl.in
341 $(QUIET_GEN
)sed
"s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
343 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
$(wildcard manpage
*.xsl
)
344 $(QUIET_XMLTO
)$(XMLTO
) -m
$(MANPAGE_XSL
) $(XMLTO_EXTRA
) man
$<
346 %.xml
: %.txt
$(ASCIIDOC_DEPS
)
347 $(QUIET_ASCIIDOC
)$(TXT_TO_XML
) -d manpage
-o
$@
$<
349 user-manual.xml
: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
350 $(QUIET_ASCIIDOC
)$(TXT_TO_XML
) -d book
-o
$@
$<
352 technical
/api-index.txt
: technical
/api-index-skel.txt \
353 technical
/api-index.sh
$(patsubst %,%.txt
,$(API_DOCS
))
354 $(QUIET_GEN
)cd technical
&& '$(SHELL_PATH_SQ)' .
/api-index.sh
356 technical
/%.html
: ASCIIDOC_EXTRA
+= -a git-relative-html-prefix
=..
/
357 $(patsubst %,%.html
,$(API_DOCS
) technical
/api-index
$(TECH_DOCS
)): %.html
: %.txt \
358 asciidoc.conf GIT-ASCIIDOCFLAGS
359 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) $*.txt
361 SubmittingPatches.txt
: SubmittingPatches
362 $(QUIET_GEN
) cp
$< $@
366 XSLTOPTS
+= --xinclude
367 XSLTOPTS
+= --stringparam html.stylesheet docbook-xsl.css
368 XSLTOPTS
+= --param generate.consistent.ids
1
370 user-manual.html
: user-manual.xml
$(XSLT
)
371 $(QUIET_XSLTPROC
)xsltproc
$(XSLTOPTS
) -o
$@
$(XSLT
) $<
373 git.
info: user-manual.texi
374 $(QUIET_MAKEINFO
)$(MAKEINFO
) --no-split
-o
$@ user-manual.texi
376 user-manual.texi
: user-manual.xml
377 $(QUIET_DB2TEXI
)$(DOCBOOK2X_TEXI
) user-manual.xml
--encoding
=UTF-8
--to-stdout
>$@
+ && \
378 $(PERL_PATH
) fix-texi.perl
<$@
+ >$@
&& \
381 user-manual.pdf
: user-manual.xml
382 $(QUIET_DBLATEX
)$(DBLATEX
) -o
$@
$(DBLATEX_COMMON
) $<
384 gitman.texi
: $(MAN_XML
) cat-texi.perl texi.xsl
386 ($(foreach xml
,$(sort $(MAN_XML
)),xsltproc
-o
$(xml
)+ texi.xsl
$(xml
) && \
387 $(DOCBOOK2X_TEXI
) --encoding
=UTF-8
--to-stdout
$(xml
)+ && \
388 $(RM
) $(xml
)+ &&) true
) > $@
+ && \
389 $(PERL_PATH
) cat-texi.perl
$@
<$@
+ >$@
&& \
392 gitman.
info: gitman.texi
393 $(QUIET_MAKEINFO
)$(MAKEINFO
) --no-split
--no-validate
$*.texi
395 $(patsubst %.txt
,%.texi
,$(MAN_TXT
)): %.texi
: %.xml
396 $(QUIET_DB2TEXI
)$(DOCBOOK2X_TEXI
) --to-stdout
$*.xml
>$@
398 howto-index.txt
: howto-index.sh
$(HOWTO_TXT
)
399 $(QUIET_GEN
)'$(SHELL_PATH_SQ)' .
/howto-index.sh
$(sort $(HOWTO_TXT
)) >$@
401 $(patsubst %,%.html
,$(ARTICLES
)) : %.html
: %.txt
402 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) $*.txt
404 WEBDOC_DEST
= /pub
/software
/scm
/git
/docs
406 howto
/%.html
: ASCIIDOC_EXTRA
+= -a git-relative-html-prefix
=..
/
407 $(patsubst %.txt
,%.html
,$(HOWTO_TXT
)): %.html
: %.txt GIT-ASCIIDOCFLAGS
409 sed
-e
'1,/^$$/d' $< | \
412 install-webdoc
: html
413 '$(SHELL_PATH_SQ)' .
/install-webdoc.sh
$(WEBDOC_DEST
)
415 # You must have a clone of 'git-htmldocs' and 'git-manpages' repositories
416 # next to the 'git' repository itself for the following to work.
418 quick-install
: quick-install-man
421 @if
test ! -d
$(MAN_REPO
); \
422 then echo
"git-manpages repository must exist at $(MAN_REPO)"; exit
1; fi
424 quick-install-man
: require-manrepo
425 '$(SHELL_PATH_SQ)' .
/install-doc-quick.sh
$(MAN_REPO
) $(DESTDIR
)$(mandir) $(GIT_MAN_REF
)
428 @if
test ! -d
$(HTML_REPO
); \
429 then echo
"git-htmldocs repository must exist at $(HTML_REPO)"; exit
1; fi
431 quick-install-html
: require-htmlrepo
432 '$(SHELL_PATH_SQ)' .
/install-doc-quick.sh
$(HTML_REPO
) $(DESTDIR
)$(htmldir
) $(GIT_MAN_REF
)
435 @for i in
$(MAN1_TXT
); do echo
$$i; done
438 LINT_DOCS_GITLINK
= $(patsubst %.txt
,.build
/lint-docs
/gitlink
/%.ok
,$(HOWTO_TXT
) $(DOC_DEP_TXT
))
439 $(LINT_DOCS_GITLINK
): lint-gitlink.perl
440 $(LINT_DOCS_GITLINK
): .build
/lint-docs
/gitlink
/%.ok
: %.txt
441 $(call mkdir_p_parent_template
)
442 $(QUIET_LINT_GITLINK
)$(PERL_PATH
) lint-gitlink.perl \
444 $(HOWTO_TXT
) $(DOC_DEP_TXT
) \
445 --section
=1 $(MAN1_TXT
) \
446 --section
=5 $(MAN5_TXT
) \
447 --section
=7 $(MAN7_TXT
) >$@
448 .PHONY
: lint-docs-gitlink
449 lint-docs-gitlink
: $(LINT_DOCS_GITLINK
)
451 ## Lint: man-end-blurb
452 LINT_DOCS_MAN_END_BLURB
= $(patsubst %.txt
,.build
/lint-docs
/man-end-blurb
/%.ok
,$(MAN_TXT
))
453 $(LINT_DOCS_MAN_END_BLURB
): lint-man-end-blurb.perl
454 $(LINT_DOCS_MAN_END_BLURB
): .build
/lint-docs
/man-end-blurb
/%.ok
: %.txt
455 $(call mkdir_p_parent_template
)
456 $(QUIET_LINT_MANEND
)$(PERL_PATH
) lint-man-end-blurb.perl
$< >$@
457 .PHONY
: lint-docs-man-end-blurb
459 ## Lint: man-section-order
460 LINT_DOCS_MAN_SECTION_ORDER
= $(patsubst %.txt
,.build
/lint-docs
/man-section-order
/%.ok
,$(MAN_TXT
))
461 $(LINT_DOCS_MAN_SECTION_ORDER
): lint-man-section-order.perl
462 $(LINT_DOCS_MAN_SECTION_ORDER
): .build
/lint-docs
/man-section-order
/%.ok
: %.txt
463 $(call mkdir_p_parent_template
)
464 $(QUIET_LINT_MANSEC
)$(PERL_PATH
) lint-man-section-order.perl
$< >$@
465 .PHONY
: lint-docs-man-section-order
466 lint-docs-man-section-order
: $(LINT_DOCS_MAN_SECTION_ORDER
)
468 ## Lint: list of targets above
470 lint-docs
: lint-docs-gitlink
471 lint-docs
: lint-docs-man-end-blurb
472 lint-docs
: lint-docs-man-section-order
474 ifeq ($(wildcard po
/Makefile
),po
/Makefile
)
475 doc-l10n install-l10n
::