help.autocorrect: do not run a command if the command given is junk
[git/dscho.git] / Documentation / Makefile
blob037220f544abb5fe9c3a98c313bdb10208a79166
1 MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard git-*.txt)) \
4 gitk.txt git.txt
5 MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \
6 gitrepository-layout.txt
7 MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \
8 gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt \
9 gitdiffcore.txt gitworkflows.txt
11 MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
12 MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
13 MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
15 DOC_HTML=$(MAN_HTML)
17 ARTICLES = howto-index
18 ARTICLES += everyday
19 ARTICLES += git-tools
20 # with their own formatting rules.
21 SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
22 API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
23 SP_ARTICLES += $(API_DOCS)
24 SP_ARTICLES += technical/api-index
26 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
28 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
29 DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
30 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
32 prefix?=$(HOME)
33 bindir?=$(prefix)/bin
34 htmldir?=$(prefix)/share/doc/git-doc
35 pdfdir?=$(prefix)/share/doc/git-doc
36 mandir?=$(prefix)/share/man
37 man1dir=$(mandir)/man1
38 man5dir=$(mandir)/man5
39 man7dir=$(mandir)/man7
40 # DESTDIR=
42 ASCIIDOC=asciidoc
43 ASCIIDOC_EXTRA =
44 MANPAGE_XSL = manpage-normal.xsl
45 XMLTO_EXTRA =
46 INSTALL?=install
47 RM ?= rm -f
48 DOC_REF = origin/man
49 HTML_REF = origin/html
51 infodir?=$(prefix)/share/info
52 MAKEINFO=makeinfo
53 INSTALL_INFO=install-info
54 DOCBOOK2X_TEXI=docbook2x-texi
55 DBLATEX=dblatex
56 ifndef PERL_PATH
57 PERL_PATH = /usr/bin/perl
58 endif
60 -include ../config.mak.autogen
61 -include ../config.mak
64 # For asciidoc ...
65 # -7.1.2, no extra settings are needed.
66 # 8.0-, set ASCIIDOC8.
70 # For docbook-xsl ...
71 # -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
72 # 1.69.0, no extra settings are needed?
73 # 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
74 # 1.71.1, no extra settings are needed?
75 # 1.72.0, set DOCBOOK_XSL_172.
76 # 1.73.0-, set ASCIIDOC_NO_ROFF
80 # If you had been using DOCBOOK_XSL_172 in an attempt to get rid
81 # of 'the ".ft C" problem' in your generated manpages, and you
82 # instead ended up with weird characters around callouts, try
83 # using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
86 ifdef ASCIIDOC8
87 ASCIIDOC_EXTRA += -a asciidoc7compatible -a no-inline-literal
88 endif
89 ifdef DOCBOOK_XSL_172
90 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
91 MANPAGE_XSL = manpage-1.72.xsl
92 else
93 ifdef ASCIIDOC_NO_ROFF
94 # docbook-xsl after 1.72 needs the regular XSL, but will not
95 # pass-thru raw roff codes from asciidoc.conf, so turn them off.
96 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
97 endif
98 endif
99 ifdef MAN_BOLD_LITERAL
100 XMLTO_EXTRA += -m manpage-bold-literal.xsl
101 endif
102 ifdef DOCBOOK_SUPPRESS_SP
103 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
104 endif
106 # Newer DocBook stylesheet emits warning cruft in the output when
107 # this is not set, and if set it shows an absolute link. Older
108 # stylesheets simply ignore this parameter.
110 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
111 # or similar.
112 ifndef MAN_BASE_URL
113 MAN_BASE_URL = file://$(htmldir)/
114 endif
115 XMLTO_EXTRA += -m manpage-base-url.xsl
117 # If your target system uses GNU groff, it may try to render
118 # apostrophes as a "pretty" apostrophe using unicode. This breaks
119 # cut&paste, so you should set GNU_ROFF to force them to be ASCII
120 # apostrophes. Unfortunately does not work with non-GNU roff.
121 ifdef GNU_ROFF
122 XMLTO_EXTRA += -m manpage-quote-apos.xsl
123 endif
125 SHELL_PATH ?= $(SHELL)
126 # Shell quote;
127 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
130 # Please note that there is a minor bug in asciidoc.
131 # The version after 6.0.3 _will_ include the patch found here:
132 # http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
134 # Until that version is released you may have to apply the patch
135 # yourself - yes, all 6 characters of it!
138 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
139 QUIET_SUBDIR1 =
141 ifneq ($(findstring $(MAKEFLAGS),w),w)
142 PRINT_DIR = --no-print-directory
143 else # "make -w"
144 NO_SUBDIR = :
145 endif
147 ifneq ($(findstring $(MAKEFLAGS),s),s)
148 ifndef V
149 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
150 QUIET_XMLTO = @echo ' ' XMLTO $@;
151 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
152 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
153 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
154 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
155 QUIET_GEN = @echo ' ' GEN $@;
156 QUIET_STDERR = 2> /dev/null
157 QUIET_SUBDIR0 = +@subdir=
158 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
159 $(MAKE) $(PRINT_DIR) -C $$subdir
160 export V
161 endif
162 endif
164 all: html man
166 html: $(DOC_HTML)
168 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
170 man: man1 man5 man7
171 man1: $(DOC_MAN1)
172 man5: $(DOC_MAN5)
173 man7: $(DOC_MAN7)
175 info: git.info gitman.info
177 pdf: user-manual.pdf
179 install: install-man
181 install-man: man
182 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
183 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
184 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
185 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
186 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
187 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
189 install-info: info
190 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
191 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
192 if test -r $(DESTDIR)$(infodir)/dir; then \
193 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
194 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
195 else \
196 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
199 install-pdf: pdf
200 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
201 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
203 install-html: html
204 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
206 ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
207 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
209 -include ../GIT-VERSION-FILE
212 # Determine "include::" file references in asciidoc files.
214 doc.dep : $(wildcard *.txt) build-docdep.perl
215 $(QUIET_GEN)$(RM) $@+ $@ && \
216 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
217 mv $@+ $@
219 -include doc.dep
221 cmds_txt = cmds-ancillaryinterrogators.txt \
222 cmds-ancillarymanipulators.txt \
223 cmds-mainporcelain.txt \
224 cmds-plumbinginterrogators.txt \
225 cmds-plumbingmanipulators.txt \
226 cmds-synchingrepositories.txt \
227 cmds-synchelpers.txt \
228 cmds-purehelpers.txt \
229 cmds-foreignscminterface.txt
231 $(cmds_txt): cmd-list.made
233 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
234 $(QUIET_GEN)$(RM) $@ && \
235 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
236 date >$@
238 clean:
239 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
240 $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
241 $(RM) howto-index.txt howto/*.html doc.dep
242 $(RM) technical/api-*.html technical/api-index.txt
243 $(RM) $(cmds_txt) *.made
244 $(RM) manpage-base-url.xsl
246 $(MAN_HTML): %.html : %.txt
247 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
248 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
249 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
250 mv $@+ $@
252 manpage-base-url.xsl: manpage-base-url.xsl.in
253 sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
255 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
256 $(QUIET_XMLTO)$(RM) $@ && \
257 xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
259 %.xml : %.txt
260 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
261 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
262 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
263 mv $@+ $@
265 user-manual.xml: user-manual.txt user-manual.conf
266 $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book $<
268 technical/api-index.txt: technical/api-index-skel.txt \
269 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
270 $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
272 $(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
273 $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
274 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
276 XSLT = docbook.xsl
277 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
279 user-manual.html: user-manual.xml
280 $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
282 git.info: user-manual.texi
283 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
285 user-manual.texi: user-manual.xml
286 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
287 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
288 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
289 rm $@++ && \
290 mv $@+ $@
292 user-manual.pdf: user-manual.xml
293 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
294 $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
295 mv $@+ $@
297 gitman.texi: $(MAN_XML) cat-texi.perl
298 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
299 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
300 --to-stdout $(xml) &&) true) > $@++ && \
301 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
302 rm $@++ && \
303 mv $@+ $@
305 gitman.info: gitman.texi
306 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
308 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
309 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
310 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
311 mv $@+ $@
313 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
314 $(QUIET_GEN)$(RM) $@+ $@ && \
315 '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
316 mv $@+ $@
318 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
319 $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 $*.txt
321 WEBDOC_DEST = /pub/software/scm/git/docs
323 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
324 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
325 sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \
326 mv $@+ $@
328 install-webdoc : html
329 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
331 quick-install: quick-install-man
333 quick-install-man:
334 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
336 quick-install-html:
337 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
339 .PHONY: .FORCE-GIT-VERSION-FILE