1 # Guard against environment variables
10 -include GIT-EXCLUDED-PROGRAMS
12 MAN1_TXT
+= $(filter-out \
13 $(patsubst %,%.txt
,$(EXCLUDED_PROGRAMS
)) \
14 $(addsuffix .txt
, $(ARTICLES
) $(SP_ARTICLES
)), \
15 $(wildcard git-
*.txt
))
18 MAN1_TXT
+= gitweb.txt
20 MAN5_TXT
+= gitattributes.txt
21 MAN5_TXT
+= githooks.txt
22 MAN5_TXT
+= gitignore.txt
23 MAN5_TXT
+= gitmodules.txt
24 MAN5_TXT
+= gitrepository-layout.txt
25 MAN5_TXT
+= gitweb.conf.txt
27 MAN7_TXT
+= gitcli.txt
28 MAN7_TXT
+= gitcore-tutorial.txt
29 MAN7_TXT
+= gitcredentials.txt
30 MAN7_TXT
+= gitcvs-migration.txt
31 MAN7_TXT
+= gitdiffcore.txt
32 MAN7_TXT
+= giteveryday.txt
33 MAN7_TXT
+= gitfaq.txt
34 MAN7_TXT
+= gitglossary.txt
35 MAN7_TXT
+= gitnamespaces.txt
36 MAN7_TXT
+= gitremote-helpers.txt
37 MAN7_TXT
+= gitrevisions.txt
38 MAN7_TXT
+= gitsubmodules.txt
39 MAN7_TXT
+= gittutorial-2.txt
40 MAN7_TXT
+= gittutorial.txt
41 MAN7_TXT
+= gitworkflows.txt
44 MAN_TXT
= $(filter $(MAN_FILTER
),$(MAN1_TXT
) $(MAN5_TXT
) $(MAN7_TXT
))
46 MAN_TXT
= $(MAN1_TXT
) $(MAN5_TXT
) $(MAN7_TXT
)
47 MAN_FILTER
= $(MAN_TXT
)
50 MAN_XML
= $(patsubst %.txt
,%.xml
,$(MAN_TXT
))
51 MAN_HTML
= $(patsubst %.txt
,%.html
,$(MAN_TXT
))
54 OBSOLETE_HTML
+= everyday.html
55 OBSOLETE_HTML
+= git-remote-helpers.html
57 ARTICLES
+= howto-index
59 ARTICLES
+= git-bisect-lk2009
60 # with their own formatting rules.
61 SP_ARTICLES
+= user-manual
62 SP_ARTICLES
+= howto
/new-command
63 SP_ARTICLES
+= howto
/revert-branch-rebase
64 SP_ARTICLES
+= howto
/using-merge-subtree
65 SP_ARTICLES
+= howto
/using-signed-tag-in-pull-request
66 SP_ARTICLES
+= howto
/use-git-daemon
67 SP_ARTICLES
+= howto
/update-hook-example
68 SP_ARTICLES
+= howto
/setup-git-server-over-http
69 SP_ARTICLES
+= howto
/separating-topic-branches
70 SP_ARTICLES
+= howto
/revert-a-faulty-merge
71 SP_ARTICLES
+= howto
/recover-corrupted-blob-object
72 SP_ARTICLES
+= howto
/recover-corrupted-object-harder
73 SP_ARTICLES
+= howto
/rebuild-from-update-hook
74 SP_ARTICLES
+= howto
/rebase-from-internal-branch
75 SP_ARTICLES
+= howto
/keep-canonical-history-correct
76 SP_ARTICLES
+= howto
/maintain-git
77 API_DOCS
= $(patsubst %.txt
,%,$(filter-out technical
/api-index-skel.txt technical
/api-index.txt
, $(wildcard technical
/api-
*.txt
)))
78 SP_ARTICLES
+= $(API_DOCS
)
80 TECH_DOCS
+= MyFirstContribution
81 TECH_DOCS
+= MyFirstObjectWalk
82 TECH_DOCS
+= SubmittingPatches
83 TECH_DOCS
+= technical
/hash-function-transition
84 TECH_DOCS
+= technical
/http-protocol
85 TECH_DOCS
+= technical
/index-format
86 TECH_DOCS
+= technical
/long-running-process-protocol
87 TECH_DOCS
+= technical
/multi-pack-index
88 TECH_DOCS
+= technical
/pack-format
89 TECH_DOCS
+= technical
/pack-heuristics
90 TECH_DOCS
+= technical
/pack-protocol
91 TECH_DOCS
+= technical
/partial-clone
92 TECH_DOCS
+= technical
/protocol-capabilities
93 TECH_DOCS
+= technical
/protocol-common
94 TECH_DOCS
+= technical
/protocol-v2
95 TECH_DOCS
+= technical
/racy-git
96 TECH_DOCS
+= technical
/send-pack-pipeline
97 TECH_DOCS
+= technical
/shallow
98 TECH_DOCS
+= technical
/signature-format
99 TECH_DOCS
+= technical
/trivial-merge
100 SP_ARTICLES
+= $(TECH_DOCS
)
101 SP_ARTICLES
+= technical
/api-index
103 ARTICLES_HTML
+= $(patsubst %,%.html
,$(ARTICLES
) $(SP_ARTICLES
))
104 HTML_FILTER ?
= $(ARTICLES_HTML
) $(OBSOLETE_HTML
)
105 DOC_HTML
= $(MAN_HTML
) $(filter $(HTML_FILTER
),$(ARTICLES_HTML
) $(OBSOLETE_HTML
))
107 DOC_MAN1
= $(patsubst %.txt
,%.1,$(filter $(MAN_FILTER
),$(MAN1_TXT
)))
108 DOC_MAN5
= $(patsubst %.txt
,%.5,$(filter $(MAN_FILTER
),$(MAN5_TXT
)))
109 DOC_MAN7
= $(patsubst %.txt
,%.7,$(filter $(MAN_FILTER
),$(MAN7_TXT
)))
112 bindir ?
= $(prefix)/bin
113 htmldir ?
= $(prefix)/share
/doc
/git-doc
114 infodir ?
= $(prefix)/share
/info
115 pdfdir ?
= $(prefix)/share
/doc
/git-doc
116 mandir ?
= $(prefix)/share
/man
117 man1dir = $(mandir)/man1
118 man5dir = $(mandir)/man5
119 man7dir = $(mandir)/man7
124 ASCIIDOC_HTML
= xhtml11
125 ASCIIDOC_DOCBOOK
= docbook
126 ASCIIDOC_CONF
= -f asciidoc.conf
127 ASCIIDOC_COMMON
= $(ASCIIDOC
) $(ASCIIDOC_EXTRA
) $(ASCIIDOC_CONF
) \
128 -amanversion
=$(GIT_VERSION
) \
129 -amanmanual
='Git Manual' -amansource
='Git'
130 TXT_TO_HTML
= $(ASCIIDOC_COMMON
) -b
$(ASCIIDOC_HTML
)
131 TXT_TO_XML
= $(ASCIIDOC_COMMON
) -b
$(ASCIIDOC_DOCBOOK
)
132 MANPAGE_XSL
= manpage-normal.xsl
137 MAN_REPO
= ..
/..
/git-manpages
138 HTML_REPO
= ..
/..
/git-htmldocs
141 INSTALL_INFO
= install-info
142 DOCBOOK2X_TEXI
= docbook2x-texi
144 ASCIIDOC_DBLATEX_DIR
= /etc
/asciidoc
/dblatex
145 DBLATEX_COMMON
= -p
$(ASCIIDOC_DBLATEX_DIR
)/asciidoc-dblatex.xsl
-s
$(ASCIIDOC_DBLATEX_DIR
)/asciidoc-dblatex.sty
147 PERL_PATH
= /usr
/bin
/perl
150 -include ..
/config.mak.autogen
151 -include ..
/config.mak
153 ifndef NO_MAN_BOLD_LITERAL
154 XMLTO_EXTRA
+= -m manpage-bold-literal.xsl
157 # Newer DocBook stylesheet emits warning cruft in the output when
158 # this is not set, and if set it shows an absolute link. Older
159 # stylesheets simply ignore this parameter.
161 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
164 MAN_BASE_URL
= file
://$(htmldir
)/
166 XMLTO_EXTRA
+= -m manpage-base-url.xsl
168 # If your target system uses GNU groff, it may try to render
169 # apostrophes as a "pretty" apostrophe using unicode. This breaks
170 # cut&paste, so you should set GNU_ROFF to force them to be ASCII
171 # apostrophes. Unfortunately does not work with non-GNU roff.
173 XMLTO_EXTRA
+= -m manpage-quote-apos.xsl
176 ifdef USE_ASCIIDOCTOR
177 ASCIIDOC
= asciidoctor
179 ASCIIDOC_HTML
= xhtml5
180 ASCIIDOC_DOCBOOK
= docbook5
181 ASCIIDOC_EXTRA
+= -acompat-mode
-atabsize
=8
182 ASCIIDOC_EXTRA
+= -I.
-rasciidoctor-extensions
183 ASCIIDOC_EXTRA
+= -alitdd
='&\#x2d;&\#x2d;'
185 XMLTO_EXTRA
+= --skip-validation
186 XMLTO_EXTRA
+= -x manpage.xsl
189 SHELL_PATH ?
= $(SHELL
)
191 SHELL_PATH_SQ
= $(subst ','\'',$(SHELL_PATH))
194 DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER
))
195 ASCIIDOC_EXTRA
+= -a
'git-default-pager=$(DEFAULT_PAGER_SQ)'
199 DEFAULT_EDITOR_SQ
= $(subst ','\'',$(DEFAULT_EDITOR))
200 ASCIIDOC_EXTRA += -a 'git-default-editor
=$(DEFAULT_EDITOR_SQ
)'
203 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
206 ifneq ($(findstring $(MAKEFLAGS),w),w)
207 PRINT_DIR = --no-print-directory
212 ifneq ($(findstring $(MAKEFLAGS),s),s)
214 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
215 QUIET_XMLTO = @echo ' ' XMLTO $@;
216 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
217 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
218 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
219 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
220 QUIET_GEN = @echo ' ' GEN $@;
221 QUIET_LINT = @echo ' ' LINT $@;
222 QUIET_STDERR = 2> /dev/null
223 QUIET_SUBDIR0 = +@subdir=
224 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
225 $(MAKE) $(PRINT_DIR) -C $$subdir
239 info: git.info gitman.info
246 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
247 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
248 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
249 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
250 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
251 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
254 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
255 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
256 if test -r $(DESTDIR)$(infodir)/dir; then \
257 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
258 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
260 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
264 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
265 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
268 '$(SHELL_PATH_SQ
)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
270 ../GIT-VERSION-FILE: FORCE
271 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
273 -include ../GIT-VERSION-FILE
276 # Determine "include::" file references in asciidoc files.
279 mergetools-list.made $(mergetools_txt) \
280 cmd-list.made $(cmds_txt)
282 doc.dep : $(docdep_prereqs) $(wildcard *.txt) $(wildcard config/*.txt) build-docdep.perl
283 $(QUIET_GEN)$(RM) $@+ $@ && \
284 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
289 cmds_txt = cmds-ancillaryinterrogators.txt \
290 cmds-ancillarymanipulators.txt \
291 cmds-mainporcelain.txt \
292 cmds-plumbinginterrogators.txt \
293 cmds-plumbingmanipulators.txt \
294 cmds-synchingrepositories.txt \
295 cmds-synchelpers.txt \
296 cmds-purehelpers.txt \
297 cmds-foreignscminterface.txt
299 $(cmds_txt): cmd-list.made
301 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
302 $(QUIET_GEN)$(RM) $@ && \
303 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
306 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
308 $(mergetools_txt): mergetools-list.made
310 mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
311 $(QUIET_GEN)$(RM) $@ && \
312 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR
=..
/mergetools
&& \
313 . ..
/git-mergetool--lib.sh
&& \
314 show_tool_names can_diff
"* " ||
:' >mergetools-diff.txt && \
315 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR
=..
/mergetools
&& \
316 . ..
/git-mergetool--lib.sh
&& \
317 show_tool_names can_merge
"* " ||
:' >mergetools-merge.txt && \
320 TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON
):$(ASCIIDOC_HTML
):$(ASCIIDOC_DOCBOOK
))
322 GIT-ASCIIDOCFLAGS
: FORCE
323 @FLAGS
='$(TRACK_ASCIIDOCFLAGS)'; \
324 if
test x
"$$FLAGS" != x
"`cat GIT-ASCIIDOCFLAGS 2>/dev/null`" ; then \
325 echo
>&2 " * new asciidoc flags"; \
326 echo
"$$FLAGS" >GIT-ASCIIDOCFLAGS
; \
330 $(RM
) *.xml
*.xml
+ *.html
*.html
+ *.1 *.5 *.7
331 $(RM
) *.texi
*.texi
+ *.texi
++ git.
info gitman.
info
333 $(RM
) howto-index.txt howto
/*.html doc.dep
334 $(RM
) technical
/*.html technical
/api-index.txt
335 $(RM
) SubmittingPatches.txt
336 $(RM
) $(cmds_txt
) $(mergetools_txt
) *.made
337 $(RM
) manpage-base-url.xsl
338 $(RM
) GIT-ASCIIDOCFLAGS
340 $(MAN_HTML
): %.html
: %.txt asciidoc.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
341 $(QUIET_ASCIIDOC
)$(RM
) $@
+ $@
&& \
342 $(TXT_TO_HTML
) -d manpage
-o
$@
+ $< && \
345 $(OBSOLETE_HTML
): %.html
: %.txto asciidoc.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
346 $(QUIET_ASCIIDOC
)$(RM
) $@
+ $@
&& \
347 $(TXT_TO_HTML
) -o
$@
+ $< && \
350 manpage-base-url.xsl
: manpage-base-url.xsl.in
351 $(QUIET_GEN
)sed
"s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
353 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
$(wildcard manpage
*.xsl
)
354 $(QUIET_XMLTO
)$(RM
) $@
&& \
355 $(XMLTO
) -m
$(MANPAGE_XSL
) $(XMLTO_EXTRA
) man
$<
357 %.xml
: %.txt asciidoc.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
358 $(QUIET_ASCIIDOC
)$(RM
) $@
+ $@
&& \
359 $(TXT_TO_XML
) -d manpage
-o
$@
+ $< && \
362 user-manual.xml
: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
363 $(QUIET_ASCIIDOC
)$(RM
) $@
+ $@
&& \
364 $(TXT_TO_XML
) -d book
-o
$@
+ $< && \
367 technical
/api-index.txt
: technical
/api-index-skel.txt \
368 technical
/api-index.sh
$(patsubst %,%.txt
,$(API_DOCS
))
369 $(QUIET_GEN
)cd technical
&& '$(SHELL_PATH_SQ)' .
/api-index.sh
371 technical
/%.html
: ASCIIDOC_EXTRA
+= -a git-relative-html-prefix
=..
/
372 $(patsubst %,%.html
,$(API_DOCS
) technical
/api-index
$(TECH_DOCS
)): %.html
: %.txt \
373 asciidoc.conf GIT-ASCIIDOCFLAGS
374 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) $*.txt
376 SubmittingPatches.txt
: SubmittingPatches
377 $(QUIET_GEN
) cp
$< $@
380 XSLTOPTS
= --xinclude
--stringparam html.stylesheet docbook-xsl.css
382 user-manual.html
: user-manual.xml
$(XSLT
)
383 $(QUIET_XSLTPROC
)$(RM
) $@
+ $@
&& \
384 xsltproc
$(XSLTOPTS
) -o
$@
+ $(XSLT
) $< && \
387 git.
info: user-manual.texi
388 $(QUIET_MAKEINFO
)$(MAKEINFO
) --no-split
-o
$@ user-manual.texi
390 user-manual.texi
: user-manual.xml
391 $(QUIET_DB2TEXI
)$(RM
) $@
+ $@
&& \
392 $(DOCBOOK2X_TEXI
) user-manual.xml
--encoding
=UTF-8
--to-stdout
>$@
++ && \
393 $(PERL_PATH
) fix-texi.perl
<$@
++ >$@
+ && \
397 user-manual.pdf
: user-manual.xml
398 $(QUIET_DBLATEX
)$(RM
) $@
+ $@
&& \
399 $(DBLATEX
) -o
$@
+ $(DBLATEX_COMMON
) $< && \
402 gitman.texi
: $(MAN_XML
) cat-texi.perl texi.xsl
403 $(QUIET_DB2TEXI
)$(RM
) $@
+ $@
&& \
404 ($(foreach xml
,$(sort $(MAN_XML
)),xsltproc
-o
$(xml
)+ texi.xsl
$(xml
) && \
405 $(DOCBOOK2X_TEXI
) --encoding
=UTF-8
--to-stdout
$(xml
)+ && \
406 rm $(xml
)+ &&) true
) > $@
++ && \
407 $(PERL_PATH
) cat-texi.perl
$@
<$@
++ >$@
+ && \
411 gitman.
info: gitman.texi
412 $(QUIET_MAKEINFO
)$(MAKEINFO
) --no-split
--no-validate
$*.texi
414 $(patsubst %.txt
,%.texi
,$(MAN_TXT
)): %.texi
: %.xml
415 $(QUIET_DB2TEXI
)$(RM
) $@
+ $@
&& \
416 $(DOCBOOK2X_TEXI
) --to-stdout
$*.xml
>$@
+ && \
419 howto-index.txt
: howto-index.sh
$(wildcard howto
/*.txt
)
420 $(QUIET_GEN
)$(RM
) $@
+ $@
&& \
421 '$(SHELL_PATH_SQ)' .
/howto-index.sh
$(sort $(wildcard howto
/*.txt
)) >$@
+ && \
424 $(patsubst %,%.html
,$(ARTICLES
)) : %.html
: %.txt
425 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) $*.txt
427 WEBDOC_DEST
= /pub
/software
/scm
/git
/docs
429 howto
/%.html
: ASCIIDOC_EXTRA
+= -a git-relative-html-prefix
=..
/
430 $(patsubst %.txt
,%.html
,$(wildcard howto
/*.txt
)): %.html
: %.txt GIT-ASCIIDOCFLAGS
431 $(QUIET_ASCIIDOC
)$(RM
) $@
+ $@
&& \
432 sed
-e
'1,/^$$/d' $< | \
433 $(TXT_TO_HTML
) - >$@
+ && \
436 install-webdoc
: html
437 '$(SHELL_PATH_SQ)' .
/install-webdoc.sh
$(WEBDOC_DEST
)
439 # You must have a clone of 'git-htmldocs' and 'git-manpages' repositories
440 # next to the 'git' repository itself for the following to work.
442 quick-install
: quick-install-man
445 @if
test ! -d
$(MAN_REPO
); \
446 then echo
"git-manpages repository must exist at $(MAN_REPO)"; exit
1; fi
448 quick-install-man
: require-manrepo
449 '$(SHELL_PATH_SQ)' .
/install-doc-quick.sh
$(MAN_REPO
) $(DESTDIR
)$(mandir) $(GIT_MAN_REF
)
452 @if
test ! -d
$(HTML_REPO
); \
453 then echo
"git-htmldocs repository must exist at $(HTML_REPO)"; exit
1; fi
455 quick-install-html
: require-htmlrepo
456 '$(SHELL_PATH_SQ)' .
/install-doc-quick.sh
$(HTML_REPO
) $(DESTDIR
)$(htmldir
) $(GIT_MAN_REF
)
459 @for i in
$(MAN1_TXT
); do echo
$$i; done
462 $(QUIET_LINT
)$(PERL_PATH
) lint-gitlink.perl
464 ifeq ($(wildcard po
/Makefile
),po
/Makefile
)
465 doc-l10n install-l10n
::