2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard git-*.txt)) \
4 gitk.txt gitweb.txt git.txt
5 MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \
6 gitrepository-layout.txt gitweb.conf.txt
7 MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \
8 gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt \
9 gitdiffcore.txt gitnamespaces.txt gitrevisions.txt gitworkflows.txt
10 MAN7_TXT += gitcredentials.txt
12 MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
13 MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
14 MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
18 ARTICLES = howto-index
21 ARTICLES += git-bisect-lk2009
22 # with their own formatting rules.
23 SP_ARTICLES = user-manual
24 SP_ARTICLES += howto/revert-branch-rebase
25 SP_ARTICLES += howto/using-merge-subtree
26 SP_ARTICLES += howto/using-signed-tag-in-pull-request
27 API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
28 SP_ARTICLES += $(API_DOCS)
29 SP_ARTICLES += technical/api-index
31 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
33 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
34 DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
35 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
39 htmldir?=$(prefix)/share/doc/git-doc
40 pdfdir?=$(prefix)/share/doc/git-doc
41 mandir?=$(prefix)/share/man
42 man1dir=$(mandir)/man1
43 man5dir=$(mandir)/man5
44 man7dir=$(mandir)/man7
49 MANPAGE_XSL = manpage-normal.xsl
53 MAN_REPO = ../../git-manpages
54 HTML_REPO = ../../git-htmldocs
56 infodir?=$(prefix)/share/info
58 INSTALL_INFO=install-info
59 DOCBOOK2X_TEXI=docbook2x-texi
62 PERL_PATH = /usr/bin/perl
65 -include ../config.mak.autogen
66 -include ../config.mak
70 # -7.1.2, set ASCIIDOC7
71 # 8.0-, no extra settings are needed
76 # -1.68.1, no extra settings are needed?
77 # 1.69.0, set ASCIIDOC_ROFF?
78 # 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
79 # 1.71.1, set ASCIIDOC_ROFF?
80 # 1.72.0, set DOCBOOK_XSL_172.
81 # 1.73.0-, no extra settings are needed
85 ASCIIDOC_EXTRA += -a asciidoc7compatible
88 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
89 MANPAGE_XSL = manpage-1.72.xsl
92 # docbook-xsl after 1.72 needs the regular XSL, but will not
93 # pass-thru raw roff codes from asciidoc.conf, so turn them off.
94 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
97 ifdef MAN_BOLD_LITERAL
98 XMLTO_EXTRA += -m manpage-bold-literal.xsl
100 ifdef DOCBOOK_SUPPRESS_SP
101 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
104 # Newer DocBook stylesheet emits warning cruft in the output when
105 # this is not set, and if set it shows an absolute link. Older
106 # stylesheets simply ignore this parameter.
108 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
111 MAN_BASE_URL = file://$(htmldir)/
113 XMLTO_EXTRA += -m manpage-base-url.xsl
115 # If your target system uses GNU groff, it may try to render
116 # apostrophes as a "pretty" apostrophe using unicode. This breaks
117 # cut&paste, so you should set GNU_ROFF to force them to be ASCII
118 # apostrophes. Unfortunately does not work with non-GNU roff.
120 XMLTO_EXTRA += -m manpage-quote-apos.xsl
123 SHELL_PATH ?= $(SHELL)
125 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
128 DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
129 ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
133 DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
134 ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
138 # Please note that there is a minor bug in asciidoc.
139 # The version after 6.0.3 _will_ include the patch found here:
140 # http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
142 # Until that version is released you may have to apply the patch
143 # yourself - yes, all 6 characters of it!
146 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
149 ifneq ($(findstring $(MAKEFLAGS),w),w)
150 PRINT_DIR = --no-print-directory
155 ifneq ($(findstring $(MAKEFLAGS),s),s)
157 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
158 QUIET_XMLTO = @echo ' ' XMLTO $@;
159 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
160 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
161 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
162 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
163 QUIET_GEN = @echo ' ' GEN $@;
164 QUIET_STDERR = 2> /dev/null
165 QUIET_SUBDIR0 = +@subdir=
166 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
167 $(MAKE) $(PRINT_DIR) -C $$subdir
176 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
183 info: git.info gitman.info
190 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
191 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
192 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
193 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
194 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
195 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
198 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
199 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
200 if test -r $(DESTDIR)$(infodir)/dir; then \
201 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
202 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
204 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
208 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
209 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
212 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
214 ../GIT-VERSION-FILE: FORCE
215 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
217 -include ../GIT-VERSION-FILE
220 # Determine "include::" file references in asciidoc files.
222 doc.dep : $(wildcard *.txt) build-docdep.perl
223 $(QUIET_GEN)$(RM) $@+ $@ && \
224 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
229 cmds_txt = cmds-ancillaryinterrogators.txt \
230 cmds-ancillarymanipulators.txt \
231 cmds-mainporcelain.txt \
232 cmds-plumbinginterrogators.txt \
233 cmds-plumbingmanipulators.txt \
234 cmds-synchingrepositories.txt \
235 cmds-synchelpers.txt \
236 cmds-purehelpers.txt \
237 cmds-foreignscminterface.txt
239 $(cmds_txt): cmd-list.made
241 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
242 $(QUIET_GEN)$(RM) $@ && \
243 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
247 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
248 $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
250 $(RM) howto-index.txt howto/*.html doc.dep
251 $(RM) technical/api-*.html technical/api-index.txt
252 $(RM) $(cmds_txt) *.made
253 $(RM) manpage-base-url.xsl
255 $(MAN_HTML): %.html : %.txt
256 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
257 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
258 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
261 manpage-base-url.xsl: manpage-base-url.xsl.in
262 sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
264 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
265 $(QUIET_XMLTO)$(RM) $@ && \
266 xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
269 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
270 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
271 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
274 user-manual.xml: user-manual.txt user-manual.conf
275 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
276 $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book -o $@+ $< && \
279 technical/api-index.txt: technical/api-index-skel.txt \
280 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
281 $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
283 technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
284 $(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
285 $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
286 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
289 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
291 user-manual.html: user-manual.xml $(XSLT)
292 $(QUIET_XSLTPROC)$(RM) $@+ $@ && \
293 xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
296 git.info: user-manual.texi
297 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
299 user-manual.texi: user-manual.xml
300 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
301 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
302 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
306 user-manual.pdf: user-manual.xml
307 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
308 $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
311 gitman.texi: $(MAN_XML) cat-texi.perl
312 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
313 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
314 --to-stdout $(xml) &&) true) > $@++ && \
315 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
319 gitman.info: gitman.texi
320 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
322 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
323 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
324 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
327 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
328 $(QUIET_GEN)$(RM) $@+ $@ && \
329 '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
332 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
333 $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 $*.txt
335 WEBDOC_DEST = /pub/software/scm/git/docs
337 howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
338 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
339 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
340 sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \
343 install-webdoc : html
344 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
346 # You must have a clone of git-htmldocs and git-manpages repositories
347 # next to the git repository itself for the following to work.
349 quick-install: quick-install-man
352 @if test ! -d $(MAN_REPO); \
353 then echo "git-manpages repository must exist at $(MAN_REPO)"; exit 1; fi
355 quick-install-man: require-manrepo
356 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(MAN_REPO) $(DESTDIR)$(mandir)
359 @if test ! -d $(HTML_REPO); \
360 then echo "git-htmldocs repository must exist at $(HTML_REPO)"; exit 1; fi
362 quick-install-html: require-htmlrepo
363 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(htmldir)