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 # -1.68.1, no extra settings are needed?
71 # 1.69.0, set ASCIIDOC_ROFF?
72 # 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
73 # 1.71.1, set ASCIIDOC_ROFF?
74 # 1.72.0, set DOCBOOK_XSL_172.
75 # 1.73.0-, no extra settings are needed
79 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
80 MANPAGE_XSL = manpage-1.72.xsl
83 # docbook-xsl after 1.72 needs the regular XSL, but will not
84 # pass-thru raw roff codes from asciidoc.conf, so turn them off.
85 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
88 ifdef MAN_BOLD_LITERAL
89 XMLTO_EXTRA += -m manpage-bold-literal.xsl
91 ifdef DOCBOOK_SUPPRESS_SP
92 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
95 # Newer DocBook stylesheet emits warning cruft in the output when
96 # this is not set, and if set it shows an absolute link. Older
97 # stylesheets simply ignore this parameter.
99 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
102 MAN_BASE_URL = file://$(htmldir)/
104 XMLTO_EXTRA += -m manpage-base-url.xsl
106 # If your target system uses GNU groff, it may try to render
107 # apostrophes as a "pretty" apostrophe using unicode. This breaks
108 # cut&paste, so you should set GNU_ROFF to force them to be ASCII
109 # apostrophes. Unfortunately does not work with non-GNU roff.
111 XMLTO_EXTRA += -m manpage-quote-apos.xsl
114 SHELL_PATH ?= $(SHELL)
116 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
119 DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
120 ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
124 DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
125 ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
128 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
131 ifneq ($(findstring $(MAKEFLAGS),w),w)
132 PRINT_DIR = --no-print-directory
137 ifneq ($(findstring $(MAKEFLAGS),s),s)
139 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
140 QUIET_XMLTO = @echo ' ' XMLTO $@;
141 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
142 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
143 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
144 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
145 QUIET_GEN = @echo ' ' GEN $@;
146 QUIET_STDERR = 2> /dev/null
147 QUIET_SUBDIR0 = +@subdir=
148 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
149 $(MAKE) $(PRINT_DIR) -C $$subdir
158 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
165 info: git.info gitman.info
172 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
173 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
174 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
175 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
176 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
177 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
180 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
181 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
182 if test -r $(DESTDIR)$(infodir)/dir; then \
183 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
184 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
186 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
190 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
191 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
194 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
196 ../GIT-VERSION-FILE: FORCE
197 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
199 -include ../GIT-VERSION-FILE
202 # Determine "include::" file references in asciidoc files.
204 doc.dep : $(wildcard *.txt) build-docdep.perl
205 $(QUIET_GEN)$(RM) $@+ $@ && \
206 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
211 cmds_txt = cmds-ancillaryinterrogators.txt \
212 cmds-ancillarymanipulators.txt \
213 cmds-mainporcelain.txt \
214 cmds-plumbinginterrogators.txt \
215 cmds-plumbingmanipulators.txt \
216 cmds-synchingrepositories.txt \
217 cmds-synchelpers.txt \
218 cmds-purehelpers.txt \
219 cmds-foreignscminterface.txt
221 $(cmds_txt): cmd-list.made
223 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
224 $(QUIET_GEN)$(RM) $@ && \
225 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
229 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
230 $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
232 $(RM) howto-index.txt howto/*.html doc.dep
233 $(RM) technical/api-*.html technical/api-index.txt
234 $(RM) $(cmds_txt) *.made
235 $(RM) manpage-base-url.xsl
237 $(MAN_HTML): %.html : %.txt
238 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
239 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
240 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
243 manpage-base-url.xsl: manpage-base-url.xsl.in
244 sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
246 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
247 $(QUIET_XMLTO)$(RM) $@ && \
248 xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
251 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
252 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
253 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
256 user-manual.xml: user-manual.txt user-manual.conf
257 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
258 $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book -o $@+ $< && \
261 technical/api-index.txt: technical/api-index-skel.txt \
262 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
263 $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
265 technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
266 $(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
267 $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
268 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
271 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
273 user-manual.html: user-manual.xml $(XSLT)
274 $(QUIET_XSLTPROC)$(RM) $@+ $@ && \
275 xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
278 git.info: user-manual.texi
279 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
281 user-manual.texi: user-manual.xml
282 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
283 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
284 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
288 user-manual.pdf: user-manual.xml
289 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
290 $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
293 gitman.texi: $(MAN_XML) cat-texi.perl
294 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
295 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
296 --to-stdout $(xml) &&) true) > $@++ && \
297 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
301 gitman.info: gitman.texi
302 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
304 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
305 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
306 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
309 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
310 $(QUIET_GEN)$(RM) $@+ $@ && \
311 '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
314 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
315 $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 $*.txt
317 WEBDOC_DEST = /pub/software/scm/git/docs
319 howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
320 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
321 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
322 sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \
325 install-webdoc : html
326 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
328 # You must have a clone of git-htmldocs and git-manpages repositories
329 # next to the git repository itself for the following to work.
331 quick-install: quick-install-man
334 @if test ! -d $(MAN_REPO); \
335 then echo "git-manpages repository must exist at $(MAN_REPO)"; exit 1; fi
337 quick-install-man: require-manrepo
338 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(MAN_REPO) $(DESTDIR)$(mandir)
341 @if test ! -d $(HTML_REPO); \
342 then echo "git-htmldocs repository must exist at $(HTML_REPO)"; exit 1; fi
344 quick-install-html: require-htmlrepo
345 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(htmldir)