send-email: refactor and ensure prompting doesn't loop forever
[git/dscho.git] / Documentation / Makefile
blob144ec32f12a7950746dd71e2ddde5b3f0cab57b0
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 = callouts.xsl
45 INSTALL?=install
46 RM ?= rm -f
47 DOC_REF = origin/man
48 HTML_REF = origin/html
50 infodir?=$(prefix)/share/info
51 MAKEINFO=makeinfo
52 INSTALL_INFO=install-info
53 DOCBOOK2X_TEXI=docbook2x-texi
54 DBLATEX=dblatex
55 ifndef PERL_PATH
56 PERL_PATH = /usr/bin/perl
57 endif
59 -include ../config.mak.autogen
60 -include ../config.mak
62 ifdef ASCIIDOC8
63 ASCIIDOC_EXTRA += -a asciidoc7compatible
64 endif
65 ifdef DOCBOOK_XSL_172
66 ASCIIDOC_EXTRA += -a docbook-xsl-172
67 MANPAGE_XSL = manpage-1.72.xsl
68 endif
71 # Please note that there is a minor bug in asciidoc.
72 # The version after 6.0.3 _will_ include the patch found here:
73 # http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
75 # Until that version is released you may have to apply the patch
76 # yourself - yes, all 6 characters of it!
79 all: html man
81 html: $(DOC_HTML)
83 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
85 man: man1 man5 man7
86 man1: $(DOC_MAN1)
87 man5: $(DOC_MAN5)
88 man7: $(DOC_MAN7)
90 info: git.info gitman.info
92 pdf: user-manual.pdf
94 install: install-man
96 install-man: man
97 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
98 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
99 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
100 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
101 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
102 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
104 install-info: info
105 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
106 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
107 if test -r $(DESTDIR)$(infodir)/dir; then \
108 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
109 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
110 else \
111 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
114 install-pdf: pdf
115 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
116 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
118 install-html: html
119 sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
121 ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
122 $(MAKE) -C ../ GIT-VERSION-FILE
124 -include ../GIT-VERSION-FILE
127 # Determine "include::" file references in asciidoc files.
129 doc.dep : $(wildcard *.txt) build-docdep.perl
130 $(RM) $@+ $@
131 $(PERL_PATH) ./build-docdep.perl >$@+
132 mv $@+ $@
134 -include doc.dep
136 cmds_txt = cmds-ancillaryinterrogators.txt \
137 cmds-ancillarymanipulators.txt \
138 cmds-mainporcelain.txt \
139 cmds-plumbinginterrogators.txt \
140 cmds-plumbingmanipulators.txt \
141 cmds-synchingrepositories.txt \
142 cmds-synchelpers.txt \
143 cmds-purehelpers.txt \
144 cmds-foreignscminterface.txt
146 $(cmds_txt): cmd-list.made
148 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
149 $(RM) $@
150 $(PERL_PATH) ./cmd-list.perl ../command-list.txt
151 date >$@
153 clean:
154 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
155 $(RM) *.texi *.texi+ git.info gitman.info
156 $(RM) howto-index.txt howto/*.html doc.dep
157 $(RM) technical/api-*.html technical/api-index.txt
158 $(RM) $(cmds_txt) *.made
160 $(MAN_HTML): %.html : %.txt
161 $(RM) $@+ $@
162 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
163 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
164 mv $@+ $@
166 %.1 %.5 %.7 : %.xml
167 $(RM) $@
168 xmlto -m $(MANPAGE_XSL) man $<
170 %.xml : %.txt
171 $(RM) $@+ $@
172 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
173 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
174 mv $@+ $@
176 user-manual.xml: user-manual.txt user-manual.conf
177 $(ASCIIDOC) -b docbook -d book $<
179 technical/api-index.txt: technical/api-index-skel.txt \
180 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
181 cd technical && sh ./api-index.sh
183 $(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
184 $(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
185 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
187 XSLT = docbook.xsl
188 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
190 user-manual.html: user-manual.xml
191 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
193 git.info: user-manual.texi
194 $(MAKEINFO) --no-split -o $@ user-manual.texi
196 user-manual.texi: user-manual.xml
197 $(RM) $@+ $@
198 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout | \
199 $(PERL_PATH) fix-texi.perl >$@+
200 mv $@+ $@
202 user-manual.pdf: user-manual.xml
203 $(RM) $@+ $@
204 $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $<
205 mv $@+ $@
207 gitman.texi: $(MAN_XML) cat-texi.perl
208 $(RM) $@+ $@
209 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
210 --to-stdout $(xml);)) | $(PERL_PATH) cat-texi.perl $@ >$@+
211 mv $@+ $@
213 gitman.info: gitman.texi
214 $(MAKEINFO) --no-split --no-validate $*.texi
216 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
217 $(RM) $@+ $@
218 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
219 mv $@+ $@
221 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
222 $(RM) $@+ $@
223 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
224 mv $@+ $@
226 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
227 $(ASCIIDOC) -b xhtml11 $*.txt
229 WEBDOC_DEST = /pub/software/scm/git/docs
231 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
232 $(RM) $@+ $@
233 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
234 mv $@+ $@
236 install-webdoc : html
237 sh ./install-webdoc.sh $(WEBDOC_DEST)
239 quick-install: quick-install-man
241 quick-install-man:
242 sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
244 quick-install-html:
245 sh ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
247 .PHONY: .FORCE-GIT-VERSION-FILE