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 ASCIIDOC_DEPS
= asciidoc.conf GIT-ASCIIDOCFLAGS
143 TXT_TO_HTML
= $(ASCIIDOC_COMMON
) -b
$(ASCIIDOC_HTML
)
144 TXT_TO_XML
= $(ASCIIDOC_COMMON
) -b
$(ASCIIDOC_DOCBOOK
)
145 MANPAGE_XSL
= manpage-normal.xsl
150 MAN_REPO
= ..
/..
/git-manpages
151 HTML_REPO
= ..
/..
/git-htmldocs
154 INSTALL_INFO
= install-info
155 DOCBOOK2X_TEXI
= docbook2x-texi
157 ASCIIDOC_DBLATEX_DIR
= /etc
/asciidoc
/dblatex
158 DBLATEX_COMMON
= -p
$(ASCIIDOC_DBLATEX_DIR
)/asciidoc-dblatex.xsl
-s
$(ASCIIDOC_DBLATEX_DIR
)/asciidoc-dblatex.sty
160 PERL_PATH
= /usr
/bin
/perl
163 -include ..
/config.mak.autogen
164 -include ..
/config.mak
166 ifndef NO_MAN_BOLD_LITERAL
167 XMLTO_EXTRA
+= -m manpage-bold-literal.xsl
170 # Newer DocBook stylesheet emits warning cruft in the output when
171 # this is not set, and if set it shows an absolute link. Older
172 # stylesheets simply ignore this parameter.
174 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
177 MAN_BASE_URL
= file
://$(htmldir
)/
179 XMLTO_EXTRA
+= -m manpage-base-url.xsl
181 # If your target system uses GNU groff, it may try to render
182 # apostrophes as a "pretty" apostrophe using unicode. This breaks
183 # cut&paste, so you should set GNU_ROFF to force them to be ASCII
184 # apostrophes. Unfortunately does not work with non-GNU roff.
186 XMLTO_EXTRA
+= -m manpage-quote-apos.xsl
189 ifdef USE_ASCIIDOCTOR
190 ASCIIDOC
= asciidoctor
192 ASCIIDOC_HTML
= xhtml5
193 ASCIIDOC_DOCBOOK
= docbook5
194 ASCIIDOC_EXTRA
+= -acompat-mode
-atabsize
=8
195 ASCIIDOC_EXTRA
+= -I.
-rasciidoctor-extensions
196 ASCIIDOC_EXTRA
+= -alitdd
='&\#x2d;&\#x2d;'
197 ASCIIDOC_DEPS
= asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
199 XMLTO_EXTRA
+= --skip-validation
200 XMLTO_EXTRA
+= -x manpage.xsl
203 SHELL_PATH ?
= $(SHELL
)
205 SHELL_PATH_SQ
= $(subst ','\'',$(SHELL_PATH))
208 DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER
))
209 ASCIIDOC_EXTRA
+= -a
'git-default-pager=$(DEFAULT_PAGER_SQ)'
213 DEFAULT_EDITOR_SQ
= $(subst ','\'',$(DEFAULT_EDITOR))
214 ASCIIDOC_EXTRA += -a 'git-default-editor
=$(DEFAULT_EDITOR_SQ
)'
217 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
220 ifneq ($(findstring $(MAKEFLAGS),w),w)
221 PRINT_DIR = --no-print-directory
226 ifneq ($(findstring $(MAKEFLAGS),s),s)
228 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
229 QUIET_XMLTO = @echo ' ' XMLTO $@;
230 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
231 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
232 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
233 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
234 QUIET_GEN = @echo ' ' GEN $@;
235 QUIET_LINT = @echo ' ' LINT $@;
236 QUIET_STDERR = 2> /dev/null
237 QUIET_SUBDIR0 = +@subdir=
238 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
239 $(MAKE) $(PRINT_DIR) -C $$subdir
253 info: git.info gitman.info
260 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
261 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
262 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
263 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
264 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
265 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
268 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
269 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
270 if test -r $(DESTDIR)$(infodir)/dir; then \
271 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
272 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
274 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
278 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
279 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
282 '$(SHELL_PATH_SQ
)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
284 ../GIT-VERSION-FILE: FORCE
285 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
287 ifneq ($(MAKECMDGOALS),clean)
288 -include ../GIT-VERSION-FILE
292 # Determine "include::" file references in asciidoc files.
295 mergetools-list.made $(mergetools_txt) \
296 cmd-list.made $(cmds_txt)
298 doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
299 $(QUIET_GEN)$(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)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
322 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
324 $(mergetools_txt): mergetools-list.made
326 mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
328 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR
=..
/mergetools
&& \
329 . ..
/git-mergetool--lib.sh
&& \
330 show_tool_names can_diff
"* " ||
:' >mergetools-diff.txt && \
331 $(SHELL_PATH) -c 'MERGE_TOOLS_DIR
=..
/mergetools
&& \
332 . ..
/git-mergetool--lib.sh
&& \
333 show_tool_names can_merge
"* " ||
:' >mergetools-merge.txt && \
336 TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON
):$(ASCIIDOC_HTML
):$(ASCIIDOC_DOCBOOK
))
338 GIT-ASCIIDOCFLAGS
: FORCE
339 @FLAGS
='$(TRACK_ASCIIDOCFLAGS)'; \
340 if
test x
"$$FLAGS" != x
"`cat GIT-ASCIIDOCFLAGS 2>/dev/null`" ; then \
341 echo
>&2 " * new asciidoc flags"; \
342 echo
"$$FLAGS" >GIT-ASCIIDOCFLAGS
; \
346 $(RM
) *.xml
*.xml
+ *.html
*.html
+ *.1 *.5 *.7
347 $(RM
) *.texi
*.texi
+ *.texi
++ git.
info gitman.
info
349 $(RM
) howto-index.txt howto
/*.html doc.dep
350 $(RM
) technical
/*.html technical
/api-index.txt
351 $(RM
) SubmittingPatches.txt
352 $(RM
) $(cmds_txt
) $(mergetools_txt
) *.made
353 $(RM
) manpage-base-url.xsl
354 $(RM
) GIT-ASCIIDOCFLAGS
356 $(MAN_HTML
): %.html
: %.txt
$(ASCIIDOC_DEPS
)
357 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) -d manpage
-o
$@
$<
359 $(OBSOLETE_HTML
): %.html
: %.txto
$(ASCIIDOC_DEPS
)
360 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) -o
$@
$<
362 manpage-base-url.xsl
: manpage-base-url.xsl.in
363 $(QUIET_GEN
)sed
"s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
365 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
$(wildcard manpage
*.xsl
)
366 $(QUIET_XMLTO
)$(XMLTO
) -m
$(MANPAGE_XSL
) $(XMLTO_EXTRA
) man
$<
368 %.xml
: %.txt
$(ASCIIDOC_DEPS
)
369 $(QUIET_ASCIIDOC
)$(TXT_TO_XML
) -d manpage
-o
$@
$<
371 user-manual.xml
: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
372 $(QUIET_ASCIIDOC
)$(TXT_TO_XML
) -d book
-o
$@
$<
374 technical
/api-index.txt
: technical
/api-index-skel.txt \
375 technical
/api-index.sh
$(patsubst %,%.txt
,$(API_DOCS
))
376 $(QUIET_GEN
)cd technical
&& '$(SHELL_PATH_SQ)' .
/api-index.sh
378 technical
/%.html
: ASCIIDOC_EXTRA
+= -a git-relative-html-prefix
=..
/
379 $(patsubst %,%.html
,$(API_DOCS
) technical
/api-index
$(TECH_DOCS
)): %.html
: %.txt \
380 asciidoc.conf GIT-ASCIIDOCFLAGS
381 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) $*.txt
383 SubmittingPatches.txt
: SubmittingPatches
384 $(QUIET_GEN
) cp
$< $@
388 XSLTOPTS
+= --xinclude
389 XSLTOPTS
+= --stringparam html.stylesheet docbook-xsl.css
390 XSLTOPTS
+= --param generate.consistent.ids
1
392 user-manual.html
: user-manual.xml
$(XSLT
)
393 $(QUIET_XSLTPROC
)xsltproc
$(XSLTOPTS
) -o
$@
$(XSLT
) $<
395 git.
info: user-manual.texi
396 $(QUIET_MAKEINFO
)$(MAKEINFO
) --no-split
-o
$@ user-manual.texi
398 user-manual.texi
: user-manual.xml
399 $(QUIET_DB2TEXI
)$(DOCBOOK2X_TEXI
) user-manual.xml
--encoding
=UTF-8
--to-stdout
>$@
+ && \
400 $(PERL_PATH
) fix-texi.perl
<$@
+ >$@
&& \
403 user-manual.pdf
: user-manual.xml
404 $(QUIET_DBLATEX
)$(DBLATEX
) -o
$@
$(DBLATEX_COMMON
) $<
406 gitman.texi
: $(MAN_XML
) cat-texi.perl texi.xsl
408 ($(foreach xml
,$(sort $(MAN_XML
)),xsltproc
-o
$(xml
)+ texi.xsl
$(xml
) && \
409 $(DOCBOOK2X_TEXI
) --encoding
=UTF-8
--to-stdout
$(xml
)+ && \
410 $(RM
) $(xml
)+ &&) true
) > $@
+ && \
411 $(PERL_PATH
) cat-texi.perl
$@
<$@
+ >$@
&& \
414 gitman.
info: gitman.texi
415 $(QUIET_MAKEINFO
)$(MAKEINFO
) --no-split
--no-validate
$*.texi
417 $(patsubst %.txt
,%.texi
,$(MAN_TXT
)): %.texi
: %.xml
418 $(QUIET_DB2TEXI
)$(DOCBOOK2X_TEXI
) --to-stdout
$*.xml
>$@
420 howto-index.txt
: howto-index.sh
$(HOWTO_TXT
)
421 $(QUIET_GEN
)'$(SHELL_PATH_SQ)' .
/howto-index.sh
$(sort $(HOWTO_TXT
)) >$@
423 $(patsubst %,%.html
,$(ARTICLES
)) : %.html
: %.txt
424 $(QUIET_ASCIIDOC
)$(TXT_TO_HTML
) $*.txt
426 WEBDOC_DEST
= /pub
/software
/scm
/git
/docs
428 howto
/%.html
: ASCIIDOC_EXTRA
+= -a git-relative-html-prefix
=..
/
429 $(patsubst %.txt
,%.html
,$(HOWTO_TXT
)): %.html
: %.txt GIT-ASCIIDOCFLAGS
431 sed
-e
'1,/^$$/d' $< | \
434 install-webdoc
: html
435 '$(SHELL_PATH_SQ)' .
/install-webdoc.sh
$(WEBDOC_DEST
)
437 # You must have a clone of 'git-htmldocs' and 'git-manpages' repositories
438 # next to the 'git' repository itself for the following to work.
440 quick-install
: quick-install-man
443 @if
test ! -d
$(MAN_REPO
); \
444 then echo
"git-manpages repository must exist at $(MAN_REPO)"; exit
1; fi
446 quick-install-man
: require-manrepo
447 '$(SHELL_PATH_SQ)' .
/install-doc-quick.sh
$(MAN_REPO
) $(DESTDIR
)$(mandir) $(GIT_MAN_REF
)
450 @if
test ! -d
$(HTML_REPO
); \
451 then echo
"git-htmldocs repository must exist at $(HTML_REPO)"; exit
1; fi
453 quick-install-html
: require-htmlrepo
454 '$(SHELL_PATH_SQ)' .
/install-doc-quick.sh
$(HTML_REPO
) $(DESTDIR
)$(htmldir
) $(GIT_MAN_REF
)
457 @for i in
$(MAN1_TXT
); do echo
$$i; done
460 $(QUIET_LINT
)$(PERL_PATH
) lint-gitlink.perl \
461 $(HOWTO_TXT
) $(DOC_DEP_TXT
) \
462 --section
=1 $(MAN1_TXT
) \
463 --section
=5 $(MAN5_TXT
) \
464 --section
=7 $(MAN7_TXT
); \
465 $(PERL_PATH
) lint-man-end-blurb.perl
$(MAN_TXT
); \
466 $(PERL_PATH
) lint-man-section-order.perl
$(MAN_TXT
);
468 ifeq ($(wildcard po
/Makefile
),po
/Makefile
)
469 doc-l10n install-l10n
::
473 # Delete the target file on error