sha1_name.c: hide get_sha1_with_context_1() ugliness
[git/debian.git] / Documentation / Makefile
blobd40e211f22dbe6c102a102041ac9f0779c7cb837
1 MAN1_TXT= \
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))
16 DOC_HTML=$(MAN_HTML)
18 ARTICLES = howto-index
19 ARTICLES += everyday
20 ARTICLES += git-tools
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))
37 prefix?=$(HOME)
38 bindir?=$(prefix)/bin
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
45 # DESTDIR=
47 ASCIIDOC=asciidoc
48 ASCIIDOC_EXTRA =
49 MANPAGE_XSL = manpage-normal.xsl
50 XMLTO_EXTRA =
51 INSTALL?=install
52 RM ?= rm -f
53 MAN_REPO = ../../git-manpages
54 HTML_REPO = ../../git-htmldocs
56 infodir?=$(prefix)/share/info
57 MAKEINFO=makeinfo
58 INSTALL_INFO=install-info
59 DOCBOOK2X_TEXI=docbook2x-texi
60 DBLATEX=dblatex
61 ifndef PERL_PATH
62 PERL_PATH = /usr/bin/perl
63 endif
65 -include ../config.mak.autogen
66 -include ../config.mak
69 # For asciidoc ...
70 # -7.1.2, set ASCIIDOC7
71 # 8.0-, no extra settings are needed
75 # For docbook-xsl ...
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
84 ifndef ASCIIDOC7
85 ASCIIDOC_EXTRA += -a asciidoc7compatible -a no-inline-literal
86 endif
87 ifdef DOCBOOK_XSL_172
88 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
89 MANPAGE_XSL = manpage-1.72.xsl
90 else
91 ifndef ASCIIDOC_ROFF
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
95 endif
96 endif
97 ifdef MAN_BOLD_LITERAL
98 XMLTO_EXTRA += -m manpage-bold-literal.xsl
99 endif
100 ifdef DOCBOOK_SUPPRESS_SP
101 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
102 endif
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/
109 # or similar.
110 ifndef MAN_BASE_URL
111 MAN_BASE_URL = file://$(htmldir)/
112 endif
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.
119 ifdef GNU_ROFF
120 XMLTO_EXTRA += -m manpage-quote-apos.xsl
121 endif
123 SHELL_PATH ?= $(SHELL)
124 # Shell quote;
125 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
128 # Please note that there is a minor bug in asciidoc.
129 # The version after 6.0.3 _will_ include the patch found here:
130 # http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
132 # Until that version is released you may have to apply the patch
133 # yourself - yes, all 6 characters of it!
136 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
137 QUIET_SUBDIR1 =
139 ifneq ($(findstring $(MAKEFLAGS),w),w)
140 PRINT_DIR = --no-print-directory
141 else # "make -w"
142 NO_SUBDIR = :
143 endif
145 ifneq ($(findstring $(MAKEFLAGS),s),s)
146 ifndef V
147 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
148 QUIET_XMLTO = @echo ' ' XMLTO $@;
149 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
150 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
151 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
152 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
153 QUIET_GEN = @echo ' ' GEN $@;
154 QUIET_STDERR = 2> /dev/null
155 QUIET_SUBDIR0 = +@subdir=
156 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
157 $(MAKE) $(PRINT_DIR) -C $$subdir
158 export V
159 endif
160 endif
162 all: html man
164 html: $(DOC_HTML)
166 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
168 man: man1 man5 man7
169 man1: $(DOC_MAN1)
170 man5: $(DOC_MAN5)
171 man7: $(DOC_MAN7)
173 info: git.info gitman.info
175 pdf: user-manual.pdf
177 install: install-man
179 install-man: man
180 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
181 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
182 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
183 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
184 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
185 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
187 install-info: info
188 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
189 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
190 if test -r $(DESTDIR)$(infodir)/dir; then \
191 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
192 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
193 else \
194 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
197 install-pdf: pdf
198 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
199 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
201 install-html: html
202 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
204 ../GIT-VERSION-FILE: FORCE
205 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
207 -include ../GIT-VERSION-FILE
210 # Determine "include::" file references in asciidoc files.
212 doc.dep : $(wildcard *.txt) build-docdep.perl
213 $(QUIET_GEN)$(RM) $@+ $@ && \
214 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
215 mv $@+ $@
217 -include doc.dep
219 cmds_txt = cmds-ancillaryinterrogators.txt \
220 cmds-ancillarymanipulators.txt \
221 cmds-mainporcelain.txt \
222 cmds-plumbinginterrogators.txt \
223 cmds-plumbingmanipulators.txt \
224 cmds-synchingrepositories.txt \
225 cmds-synchelpers.txt \
226 cmds-purehelpers.txt \
227 cmds-foreignscminterface.txt
229 $(cmds_txt): cmd-list.made
231 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
232 $(QUIET_GEN)$(RM) $@ && \
233 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
234 date >$@
236 clean:
237 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
238 $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
239 $(RM) *.pdf
240 $(RM) howto-index.txt howto/*.html doc.dep
241 $(RM) technical/api-*.html technical/api-index.txt
242 $(RM) $(cmds_txt) *.made
243 $(RM) manpage-base-url.xsl
245 $(MAN_HTML): %.html : %.txt
246 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
247 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
248 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
249 mv $@+ $@
251 manpage-base-url.xsl: manpage-base-url.xsl.in
252 sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
254 %.1 %.5 %.7 : %.xml manpage-base-url.xsl
255 $(QUIET_XMLTO)$(RM) $@ && \
256 xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
258 %.xml : %.txt
259 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
260 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
261 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
262 mv $@+ $@
264 user-manual.xml: user-manual.txt user-manual.conf
265 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
266 $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book -o $@+ $< && \
267 mv $@+ $@
269 technical/api-index.txt: technical/api-index-skel.txt \
270 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
271 $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
273 $(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
274 $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
275 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
277 XSLT = docbook.xsl
278 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
280 user-manual.html: user-manual.xml $(XSLT)
281 $(QUIET_XSLTPROC)$(RM) $@+ $@ && \
282 xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
283 mv $@+ $@
285 git.info: user-manual.texi
286 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
288 user-manual.texi: user-manual.xml
289 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
290 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
291 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
292 rm $@++ && \
293 mv $@+ $@
295 user-manual.pdf: user-manual.xml
296 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
297 $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
298 mv $@+ $@
300 gitman.texi: $(MAN_XML) cat-texi.perl
301 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
302 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
303 --to-stdout $(xml) &&) true) > $@++ && \
304 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
305 rm $@++ && \
306 mv $@+ $@
308 gitman.info: gitman.texi
309 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
311 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
312 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
313 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
314 mv $@+ $@
316 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
317 $(QUIET_GEN)$(RM) $@+ $@ && \
318 '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
319 mv $@+ $@
321 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
322 $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 $*.txt
324 WEBDOC_DEST = /pub/software/scm/git/docs
326 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
327 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
328 sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \
329 mv $@+ $@
331 install-webdoc : html
332 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
334 # You must have a clone of git-htmldocs and git-manpages repositories
335 # next to the git repository itself for the following to work.
337 quick-install: quick-install-man
339 require-manrepo::
340 @if test ! -d $(MAN_REPO); \
341 then echo "git-manpages repository must exist at $(MAN_REPO)"; exit 1; fi
343 quick-install-man: require-manrepo
344 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(MAN_REPO) $(DESTDIR)$(mandir)
346 require-htmlrepo::
347 @if test ! -d $(HTML_REPO); \
348 then echo "git-htmldocs repository must exist at $(HTML_REPO)"; exit 1; fi
350 quick-install-html: require-htmlrepo
351 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(htmldir)
353 .PHONY: FORCE