1 # Guard against environment variables
12 -include GIT-EXCLUDED-PROGRAMS
14 MAN1_TXT
+= $(filter-out \
15 $(patsubst %,%.txt
,$(EXCLUDED_PROGRAMS
)) \
16 $(addsuffix .txt
, $(ARTICLES
) $(SP_ARTICLES
)), \
17 $(wildcard git-
*.txt
))
20 MAN1_TXT
+= gitweb.txt
22 # man5 / man7 guides (note: new guides should also be added to command-list.txt)
23 MAN5_TXT
+= gitattributes.txt
24 MAN5_TXT
+= githooks.txt
25 MAN5_TXT
+= gitignore.txt
26 MAN5_TXT
+= gitmailmap.txt
27 MAN5_TXT
+= gitmodules.txt
28 MAN5_TXT
+= gitrepository-layout.txt
29 MAN5_TXT
+= gitweb.conf.txt
31 MAN7_TXT
+= gitcli.txt
32 MAN7_TXT
+= gitcore-tutorial.txt
33 MAN7_TXT
+= gitcredentials.txt
34 MAN7_TXT
+= gitcvs-migration.txt
35 MAN7_TXT
+= gitdiffcore.txt
36 MAN7_TXT
+= giteveryday.txt
37 MAN7_TXT
+= gitfaq.txt
38 MAN7_TXT
+= gitglossary.txt
39 MAN7_TXT
+= gitnamespaces.txt
40 MAN7_TXT
+= gitremote-helpers.txt
41 MAN7_TXT
+= gitrevisions.txt
42 MAN7_TXT
+= gitsubmodules.txt
43 MAN7_TXT
+= gittutorial-2.txt
44 MAN7_TXT
+= gittutorial.txt
45 MAN7_TXT
+= gitworkflows.txt
47 HOWTO_TXT
+= $(wildcard howto
/*.txt
)
49 DOC_DEP_TXT
+= $(wildcard *.txt
)
50 DOC_DEP_TXT
+= $(wildcard config
/*.txt
)
53 MAN_TXT
= $(filter $(MAN_FILTER
),$(MAN1_TXT
) $(MAN5_TXT
) $(MAN7_TXT
))
55 MAN_TXT
= $(MAN1_TXT
) $(MAN5_TXT
) $(MAN7_TXT
)
56 MAN_FILTER
= $(MAN_TXT
)
59 MAN_XML
= $(patsubst %.txt
,%.xml
,$(MAN_TXT
))
60 MAN_HTML
= $(patsubst %.txt
,%.html
,$(MAN_TXT
))
63 OBSOLETE_HTML
+= everyday.html
64 OBSOLETE_HTML
+= git-remote-helpers.html
66 ARTICLES
+= howto-index
68 ARTICLES
+= git-bisect-lk2009
69 # with their own formatting rules.
70 SP_ARTICLES
+= user-manual
71 SP_ARTICLES
+= howto
/new-command
72 SP_ARTICLES
+= howto
/revert-branch-rebase
73 SP_ARTICLES
+= howto
/using-merge-subtree
74 SP_ARTICLES
+= howto
/using-signed-tag-in-pull-request
75 SP_ARTICLES
+= howto
/use-git-daemon
76 SP_ARTICLES
+= howto
/update-hook-example
77 SP_ARTICLES
+= howto
/setup-git-server-over-http
78 SP_ARTICLES
+= howto
/separating-topic-branches
79 SP_ARTICLES
+= howto
/revert-a-faulty-merge
80 SP_ARTICLES
+= howto
/recover-corrupted-blob-object
81 SP_ARTICLES
+= howto
/recover-corrupted-object-harder
82 SP_ARTICLES
+= howto
/rebuild-from-update-hook
83 SP_ARTICLES
+= howto
/rebase-from-internal-branch
84 SP_ARTICLES
+= howto
/keep-canonical-history-correct
85 SP_ARTICLES
+= howto
/maintain-git
86 SP_ARTICLES
+= howto
/coordinate-embargoed-releases
87 API_DOCS
= $(patsubst %.txt
,%,$(filter-out technical
/api-index-skel.txt technical
/api-index.txt
, $(wildcard technical
/api-
*.txt
)))
88 SP_ARTICLES
+= $(API_DOCS
)
90 TECH_DOCS
+= MyFirstContribution
91 TECH_DOCS
+= MyFirstObjectWalk
92 TECH_DOCS
+= SubmittingPatches
93 TECH_DOCS
+= technical
/hash-function-transition
94 TECH_DOCS
+= technical
/http-protocol
95 TECH_DOCS
+= technical
/index-format
96 TECH_DOCS
+= technical
/long-running-process-protocol
97 TECH_DOCS
+= technical
/multi-pack-index
98 TECH_DOCS
+= technical
/pack-format
99 TECH_DOCS
+= technical
/pack-heuristics
100 TECH_DOCS
+= technical
/pack-protocol
101 TECH_DOCS
+= technical
/parallel-checkout
102 TECH_DOCS
+= technical
/partial-clone
103 TECH_DOCS
+= technical
/protocol-capabilities
104 TECH_DOCS
+= technical
/protocol-common
105 TECH_DOCS
+= technical
/protocol-v2
106 TECH_DOCS
+= technical
/racy-git
107 TECH_DOCS
+= technical
/reftable
108 TECH_DOCS
+= technical
/send-pack-pipeline
109 TECH_DOCS
+= technical
/shallow
110 TECH_DOCS
+= technical
/signature-format
111 TECH_DOCS
+= technical
/trivial-merge
112 SP_ARTICLES
+= $(TECH_DOCS
)
113 SP_ARTICLES
+= technical
/api-index
115 ARTICLES_HTML
+= $(patsubst %,%.html
,$(ARTICLES
) $(SP_ARTICLES
))
116 HTML_FILTER ?
= $(ARTICLES_HTML
) $(OBSOLETE_HTML
)
117 DOC_HTML
= $(MAN_HTML
) $(filter $(HTML_FILTER
),$(ARTICLES_HTML
) $(OBSOLETE_HTML
))
119 DOC_MAN1
= $(patsubst %.txt
,%.1,$(filter $(MAN_FILTER
),$(MAN1_TXT
)))
120 DOC_MAN5
= $(patsubst %.txt
,%.5,$(filter $(MAN_FILTER
),$(MAN5_TXT
)))
121 DOC_MAN7
= $(patsubst %.txt
,%.7,$(filter $(MAN_FILTER
),$(MAN7_TXT
)))
124 bindir ?
= $(prefix)/bin
125 htmldir ?
= $(prefix)/share
/doc
/git-doc
126 infodir ?
= $(prefix)/share
/info
127 pdfdir ?
= $(prefix)/share
/doc
/git-doc
128 mandir ?
= $(prefix)/share
/man
129 man1dir = $(mandir)/man1
130 man5dir = $(mandir)/man5
131 man7dir = $(mandir)/man7
136 ASCIIDOC_HTML
= xhtml11
137 ASCIIDOC_DOCBOOK
= docbook
138 ASCIIDOC_CONF
= -f asciidoc.conf
139 ASCIIDOC_COMMON
= $(ASCIIDOC
) $(ASCIIDOC_EXTRA
) $(ASCIIDOC_CONF
) \
140 -amanversion
=$(GIT_VERSION
) \
141 -amanmanual
='Git Manual' -amansource
='Git'
142 TXT_TO_HTML
= $(ASCIIDOC_COMMON
) -b
$(ASCIIDOC_HTML
)
143 TXT_TO_XML
= $(ASCIIDOC_COMMON
) -b
$(ASCIIDOC_DOCBOOK
)
144 MANPAGE_XSL
= manpage-normal.xsl
149 MAN_REPO
= ..
/..
/git-manpages
150 HTML_REPO
= ..
/..
/git-htmldocs
153 INSTALL_INFO
= install-info
154 DOCBOOK2X_TEXI
= docbook2x-texi
156 ASCIIDOC_DBLATEX_DIR
= /etc
/asciidoc
/dblatex
157 DBLATEX_COMMON
= -p
$(ASCIIDOC_DBLATEX_DIR
)/asciidoc-dblatex.xsl
-s
$(ASCIIDOC_DBLATEX_DIR
)/asciidoc-dblatex.sty
159 PERL_PATH
= /usr
/bin
/perl
162 -include ..
/config.mak.autogen
163 -include ..
/config.mak
165 ifndef NO_MAN_BOLD_LITERAL
166 XMLTO_EXTRA
+= -m manpage-bold-literal.xsl
169 # Newer DocBook stylesheet emits warning cruft in the output when
170 # this is not set, and if set it shows an absolute link. Older
171 # stylesheets simply ignore this parameter.
173 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
176 MAN_BASE_URL
= file
://$(htmldir
)/
178 XMLTO_EXTRA
+= -m manpage-base-url.xsl
180 # If your target system uses GNU groff, it may try to render
181 # apostrophes as a "pretty" apostrophe using unicode. This breaks
182 # cut&paste, so you should set GNU_ROFF to force them to be ASCII
183 # apostrophes. Unfortunately does not work with non-GNU roff.
185 XMLTO_EXTRA
+= -m manpage-quote-apos.xsl
188 ifdef USE_ASCIIDOCTOR
189 ASCIIDOC
= asciidoctor
191 ASCIIDOC_HTML
= xhtml5
192 ASCIIDOC_DOCBOOK
= docbook5
193 ASCIIDOC_EXTRA
+= -acompat-mode
-atabsize
=8
194 ASCIIDOC_EXTRA
+= -I.
-rasciidoctor-extensions
195 ASCIIDOC_EXTRA
+= -alitdd
='&\#x2d;&\#x2d;'
197 XMLTO_EXTRA
+= --skip-validation
198 XMLTO_EXTRA
+= -x manpage.xsl
201 SHELL_PATH ?
= $(SHELL
)
203 SHELL_PATH_SQ
= $(subst ','\'',$(SHELL_PATH))
206 DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER
))
207 ASCIIDOC_EXTRA
+= -a
'git-default-pager=$(DEFAULT_PAGER_SQ)'
211 DEFAULT_EDITOR_SQ
= $(subst ','\'',$(DEFAULT_EDITOR))
212 ASCIIDOC_EXTRA += -a 'git-default-editor
=$(DEFAULT_EDITOR_SQ
)'
215 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
218 ifneq ($(findstring $(MAKEFLAGS),w),w)
219 PRINT_DIR = --no-print-directory
224 ifneq ($(findstring $(MAKEFLAGS),s),s)
226 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
227 QUIET_XMLTO = @echo ' ' XMLTO $@;
228 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
229 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
230 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
231 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
232 QUIET_GEN = @echo ' ' GEN $@;
233 QUIET_LINT = @echo ' ' LINT $@;
234 QUIET_STDERR = 2> /dev/null
235 QUIET_SUBDIR0 = +@subdir=
236 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
237 $(MAKE) $(PRINT_DIR) -C $$subdir
251 info: git.info gitman.info
258 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
259 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
260 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
261 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
262 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
263 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
266 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
267 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
268 if test -r $(DESTDIR)$(infodir)/dir; then \
269 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
270 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
272 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
276 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
277 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
280 '$(SHELL_PATH_SQ
)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
282 ../GIT-VERSION-FILE: FORCE
283 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
285 ifneq ($(MAKECMDGOALS),clean)
286 -include ../GIT-VERSION-FILE
290 # Determine "include::" file references in asciidoc files.
293 mergetools-list.made $(mergetools_txt) \
294 cmd-list.made $(cmds_txt)
296 doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
297 $(QUIET_GEN)$(RM) $@+ $@ && \
298 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
301 ifneq ($(MAKECMDGOALS),clean)
305 cmds_txt = cmds-ancillaryinterrogators.txt \
306 cmds-ancillarymanipulators.txt \
307 cmds-mainporcelain.txt \
308 cmds-plumbinginterrogators.txt \
309 cmds-plumbingmanipulators.txt \
310 cmds-synchingrepositories.txt \
311 cmds-synchelpers.txt \
313 cmds-purehelpers.txt \
314 cmds-foreignscminterface.txt
316 $(cmds_txt): cmd-list.made
318 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
319 $(QUIET_GEN)$(RM) $@ && \
320 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
323 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
325 $(mergetools_txt): mergetools-list.made
327 mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
328 $(QUIET_GEN)$(RM) $@ && \
329 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR
=..
/mergetools
&& \
330 . ..
/git-mergetool--lib.sh
&& \
331 show_tool_names can_diff
"* " ||
:' >mergetools-diff.txt && \
332 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR
=..
/mergetools
&& \
333 . ..
/git-mergetool--lib.sh
&& \
334 show_tool_names can_merge
"* " ||
:' >mergetools-merge.txt && \
337 TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON
):$(ASCIIDOC_HTML
):$(ASCIIDOC_DOCBOOK
))
339 GIT-ASCIIDOCFLAGS
: FORCE
340 @FLAGS
='$(TRACK_ASCIIDOCFLAGS)'; \
341 if
test x
"$$FLAGS" != x
"`cat GIT-ASCIIDOCFLAGS 2>/dev/null`" ; then \
342 echo
>&2 " * new asciidoc flags"; \
343 echo
"$$FLAGS" >GIT-ASCIIDOCFLAGS
; \
347 $(RM
) *.xml
*.xml
+ *.html
*.html
+ *.1 *.5 *.7
348 $(RM
) *.texi
*.texi
+ *.texi
++ git.
info gitman.
info
350 $(RM
) howto-index.txt howto
/*.html doc.dep
351 $(RM
) technical
/*.html technical
/api-index.txt
352 $(RM
) SubmittingPatches.txt
353 $(RM
) $(cmds_txt
) $(mergetools_txt
) *.made
354 $(RM
) manpage-base-url.xsl
355 $(RM
) GIT-ASCIIDOCFLAGS
357 $(MAN_HTML
): %.html
: %.txt asciidoc.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
358 $(QUIET_ASCIIDOC
)$(RM
) $@
+ $@
&& \
359 $(TXT_TO_HTML
) -d manpage
-o
$@
+ $< && \
362 $(OBSOLETE_HTML
): %.html
: %.txto asciidoc.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
363 $(QUIET_ASCIIDOC
)$(RM
) $@
+ $@
&& \
364 $(TXT_TO_HTML
) -o
$@
+ $< && \
367 manpage-base-url.xsl
: manpage-base-url.xsl.in
368 $(QUIET_GEN
)sed
"s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
370 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
$(wildcard manpage
*.xsl
)
371 $(QUIET_XMLTO
)$(RM
) $@
&& \
372 $(XMLTO
) -m
$(MANPAGE_XSL
) $(XMLTO_EXTRA
) man
$<
374 %.xml
: %.txt asciidoc.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
375 $(QUIET_ASCIIDOC
)$(RM
) $@
+ $@
&& \
376 $(TXT_TO_XML
) -d manpage
-o
$@
+ $< && \
379 user-manual.xml
: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
380 $(QUIET_ASCIIDOC
)$(RM
) $@
+ $@
&& \
381 $(TXT_TO_XML
) -d book
-o
$@
+ $< && \
384 technical
/api-index.txt
: technical
/api-index-skel.txt \
385 technical
/api-index.sh
$(patsubst %,%.txt
,$(API_DOCS
))
386 $(QUIET_GEN
)cd technical
&& '$(SHELL_PATH_SQ)' .
/api-index.sh
388 technical
/%.html
: ASCIIDOC_EXTRA
+= -a git-relative-html-prefix
=..
/
389 $(patsubst %,%.html
,$(API_DOCS
) technical
/api-index
$(TECH_DOCS
)): %.html
: %.txt \
390 asciidoc.conf GIT-ASCIIDOCFLAGS
391 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) $*.txt
393 SubmittingPatches.txt
: SubmittingPatches
394 $(QUIET_GEN
) cp
$< $@
398 XSLTOPTS
+= --xinclude
399 XSLTOPTS
+= --stringparam html.stylesheet docbook-xsl.css
400 XSLTOPTS
+= --param generate.consistent.ids
1
402 user-manual.html
: user-manual.xml
$(XSLT
)
403 $(QUIET_XSLTPROC
)$(RM
) $@
+ $@
&& \
404 xsltproc
$(XSLTOPTS
) -o
$@
+ $(XSLT
) $< && \
407 git.
info: user-manual.texi
408 $(QUIET_MAKEINFO
)$(MAKEINFO
) --no-split
-o
$@ user-manual.texi
410 user-manual.texi
: user-manual.xml
411 $(QUIET_DB2TEXI
)$(RM
) $@
+ $@
&& \
412 $(DOCBOOK2X_TEXI
) user-manual.xml
--encoding
=UTF-8
--to-stdout
>$@
++ && \
413 $(PERL_PATH
) fix-texi.perl
<$@
++ >$@
+ && \
417 user-manual.pdf
: user-manual.xml
418 $(QUIET_DBLATEX
)$(RM
) $@
+ $@
&& \
419 $(DBLATEX
) -o
$@
+ $(DBLATEX_COMMON
) $< && \
422 gitman.texi
: $(MAN_XML
) cat-texi.perl texi.xsl
423 $(QUIET_DB2TEXI
)$(RM
) $@
+ $@
&& \
424 ($(foreach xml
,$(sort $(MAN_XML
)),xsltproc
-o
$(xml
)+ texi.xsl
$(xml
) && \
425 $(DOCBOOK2X_TEXI
) --encoding
=UTF-8
--to-stdout
$(xml
)+ && \
426 rm $(xml
)+ &&) true
) > $@
++ && \
427 $(PERL_PATH
) cat-texi.perl
$@
<$@
++ >$@
+ && \
431 gitman.
info: gitman.texi
432 $(QUIET_MAKEINFO
)$(MAKEINFO
) --no-split
--no-validate
$*.texi
434 $(patsubst %.txt
,%.texi
,$(MAN_TXT
)): %.texi
: %.xml
435 $(QUIET_DB2TEXI
)$(RM
) $@
+ $@
&& \
436 $(DOCBOOK2X_TEXI
) --to-stdout
$*.xml
>$@
+ && \
439 howto-index.txt
: howto-index.sh
$(HOWTO_TXT
)
440 $(QUIET_GEN
)$(RM
) $@
+ $@
&& \
441 '$(SHELL_PATH_SQ)' .
/howto-index.sh
$(sort $(HOWTO_TXT
)) >$@
+ && \
444 $(patsubst %,%.html
,$(ARTICLES
)) : %.html
: %.txt
445 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) $*.txt
447 WEBDOC_DEST
= /pub
/software
/scm
/git
/docs
449 howto
/%.html
: ASCIIDOC_EXTRA
+= -a git-relative-html-prefix
=..
/
450 $(patsubst %.txt
,%.html
,$(HOWTO_TXT
)): %.html
: %.txt GIT-ASCIIDOCFLAGS
451 $(QUIET_ASCIIDOC
)$(RM
) $@
+ $@
&& \
452 sed
-e
'1,/^$$/d' $< | \
453 $(TXT_TO_HTML
) - >$@
+ && \
456 install-webdoc
: html
457 '$(SHELL_PATH_SQ)' .
/install-webdoc.sh
$(WEBDOC_DEST
)
459 # You must have a clone of 'git-htmldocs' and 'git-manpages' repositories
460 # next to the 'git' repository itself for the following to work.
462 quick-install
: quick-install-man
465 @if
test ! -d
$(MAN_REPO
); \
466 then echo
"git-manpages repository must exist at $(MAN_REPO)"; exit
1; fi
468 quick-install-man
: require-manrepo
469 '$(SHELL_PATH_SQ)' .
/install-doc-quick.sh
$(MAN_REPO
) $(DESTDIR
)$(mandir) $(GIT_MAN_REF
)
472 @if
test ! -d
$(HTML_REPO
); \
473 then echo
"git-htmldocs repository must exist at $(HTML_REPO)"; exit
1; fi
475 quick-install-html
: require-htmlrepo
476 '$(SHELL_PATH_SQ)' .
/install-doc-quick.sh
$(HTML_REPO
) $(DESTDIR
)$(htmldir
) $(GIT_MAN_REF
)
479 @for i in
$(MAN1_TXT
); do echo
$$i; done
482 $(QUIET_LINT
)$(PERL_PATH
) lint-gitlink.perl \
483 $(HOWTO_TXT
) $(DOC_DEP_TXT
) \
484 --section
=1 $(MAN1_TXT
) \
485 --section
=5 $(MAN5_TXT
) \
486 --section
=7 $(MAN7_TXT
); \
487 $(PERL_PATH
) lint-man-end-blurb.perl
$(MAN_TXT
); \
488 $(PERL_PATH
) lint-man-section-order.perl
$(MAN_TXT
);
490 ifeq ($(wildcard po
/Makefile
),po
/Makefile
)
491 doc-l10n install-l10n
::