Merge branch 'maint'
[git/git.git] / Documentation / Makefile
CommitLineData
4a5d6939
MW
1MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard git-*.txt)) \
9e1f0a85 4 gitk.txt git.txt
30eba7bf
CC
5MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \
6 gitrepository-layout.txt
9e1f0a85 7MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \
30eba7bf 8 gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt \
f948dd89 9 gitdiffcore.txt gitworkflows.txt
b790abb8 10
5cefc33b
JH
11MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
12MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
13MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
14
15DOC_HTML=$(MAN_HTML)
8db9307c 16
30eba7bf 17ARTICLES = howto-index
db9536c8 18ARTICLES += everyday
4a5d6939 19ARTICLES += git-tools
8db9307c 20# with their own formatting rules.
471a5ce5 21SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
530e741c
JH
22API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
23SP_ARTICLES += $(API_DOCS)
24SP_ARTICLES += technical/api-index
8db9307c
JH
25
26DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
789d5774 27
b2bf34d6 28DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
2d76548b 29DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
b2bf34d6
DG
30DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
31
d2b8593f 32prefix?=$(HOME)
e14421b9 33bindir?=$(prefix)/bin
5d6491c7 34htmldir?=$(prefix)/share/doc/git-doc
a325a1a7 35pdfdir?=$(prefix)/share/doc/git-doc
45fd8bd3 36mandir?=$(prefix)/share/man
7b8cf0cf 37man1dir=$(mandir)/man1
4392da4d 38man5dir=$(mandir)/man5
7b8cf0cf 39man7dir=$(mandir)/man7
a682ef9f 40# DESTDIR=
87a81c83 41
1187d756 42ASCIIDOC=asciidoc
26cfcfbf 43ASCIIDOC_EXTRA =
7a2078b4 44MANPAGE_XSL = callouts.xsl
d2b8593f 45INSTALL?=install
4cb08df5 46RM ?= rm -f
6538d1ef 47DOC_REF = origin/man
6fe570de 48HTML_REF = origin/html
87a81c83 49
4739809c
DK
50infodir?=$(prefix)/share/info
51MAKEINFO=makeinfo
52INSTALL_INFO=install-info
53DOCBOOK2X_TEXI=docbook2x-texi
a325a1a7 54DBLATEX=dblatex
c680dd83
JH
55ifndef PERL_PATH
56 PERL_PATH = /usr/bin/perl
57endif
4739809c 58
95676853 59-include ../config.mak.autogen
4fa96e15 60-include ../config.mak
95676853 61
7f55cf45
JF
62ifdef ASCIIDOC8
63ASCIIDOC_EXTRA += -a asciidoc7compatible
64endif
65ifdef DOCBOOK_XSL_172
66ASCIIDOC_EXTRA += -a docbook-xsl-172
7a2078b4 67MANPAGE_XSL = manpage-1.72.xsl
7f55cf45
JF
68endif
69
b2bf34d6
DG
70#
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
74#
75# Until that version is released you may have to apply the patch
76# yourself - yes, all 6 characters of it!
77#
78
79all: html man
b790abb8
DG
80
81html: $(DOC_HTML)
82
4392da4d 83$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
b2bf34d6 84
4392da4d 85man: man1 man5 man7
b2bf34d6 86man1: $(DOC_MAN1)
4392da4d 87man5: $(DOC_MAN5)
b2bf34d6 88man7: $(DOC_MAN7)
b790abb8 89
5cefc33b 90info: git.info gitman.info
4739809c 91
a325a1a7
MV
92pdf: user-manual.pdf
93
b1a46b70
MH
94install: install-man
95
96install-man: man
41650765
RS
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)
87a81c83 103
4739809c 104install-info: info
41650765 105 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
5cefc33b 106 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
4739809c
DK
107 if test -r $(DESTDIR)$(infodir)/dir; then \
108 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
5cefc33b 109 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
4739809c
DK
110 else \
111 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
112 fi
37465016 113
a325a1a7
MV
114install-pdf: pdf
115 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
116 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
117
5d6491c7
CC
118install-html: html
119 sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
120
7b8a74f3
FL
121../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
122 $(MAKE) -C ../ GIT-VERSION-FILE
123
124-include ../GIT-VERSION-FILE
125
93d69d86
JL
126#
127# Determine "include::" file references in asciidoc files.
128#
fb612d54 129doc.dep : $(wildcard *.txt) build-docdep.perl
4cb08df5 130 $(RM) $@+ $@
c680dd83 131 $(PERL_PATH) ./build-docdep.perl >$@+
a5ae8e64 132 mv $@+ $@
93d69d86 133
a5ae8e64 134-include doc.dep
37465016 135
72fe6a59
JH
136cmds_txt = cmds-ancillaryinterrogators.txt \
137 cmds-ancillarymanipulators.txt \
138 cmds-mainporcelain.txt \
139 cmds-plumbinginterrogators.txt \
140 cmds-plumbingmanipulators.txt \
89bf2077
JH
141 cmds-synchingrepositories.txt \
142 cmds-synchelpers.txt \
143 cmds-purehelpers.txt \
144 cmds-foreignscminterface.txt
72fe6a59 145
d7907392
JH
146$(cmds_txt): cmd-list.made
147
79d30668 148cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
f9286765 149 $(RM) $@
c680dd83 150 $(PERL_PATH) ./cmd-list.perl ../command-list.txt
d7907392 151 date >$@
b790abb8
DG
152
153clean:
4c785e50
JH
154 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
155 $(RM) *.texi *.texi+ git.info gitman.info
530e741c
JH
156 $(RM) howto-index.txt howto/*.html doc.dep
157 $(RM) technical/api-*.html technical/api-index.txt
4cb08df5 158 $(RM) $(cmds_txt) *.made
b790abb8 159
530e741c 160$(MAN_HTML): %.html : %.txt
4cb08df5 161 $(RM) $@+ $@
7b8a74f3 162 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
4159c578 163 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
7b8a74f3 164 mv $@+ $@
b790abb8 165
4392da4d 166%.1 %.5 %.7 : %.xml
50cff52f 167 $(RM) $@
7a2078b4 168 xmlto -m $(MANPAGE_XSL) man $<
b790abb8
DG
169
170%.xml : %.txt
4cb08df5 171 $(RM) $@+ $@
7b8a74f3 172 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
4159c578 173 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
7b8a74f3 174 mv $@+ $@
3f971fc4 175
d19fbc3c 176user-manual.xml: user-manual.txt user-manual.conf
1187d756 177 $(ASCIIDOC) -b docbook -d book $<
d19fbc3c 178
530e741c
JH
179technical/api-index.txt: technical/api-index-skel.txt \
180 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
181 cd technical && sh ./api-index.sh
182
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
186
1cffddd6 187XSLT = docbook.xsl
0a3985dc 188XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
1c95c565 189
d19fbc3c 190user-manual.html: user-manual.xml
1c95c565 191 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
d19fbc3c 192
50b3555c
JH
193git.info: user-manual.texi
194 $(MAKEINFO) --no-split -o $@ user-manual.texi
5cefc33b 195
50b3555c 196user-manual.texi: user-manual.xml
5cefc33b 197 $(RM) $@+ $@
8b30ad01
TL
198 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout | \
199 $(PERL_PATH) fix-texi.perl >$@+
5cefc33b
JH
200 mv $@+ $@
201
a325a1a7
MV
202user-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 $@+ $@
206
5cefc33b
JH
207gitman.texi: $(MAN_XML) cat-texi.perl
208 $(RM) $@+ $@
8b30ad01
TL
209 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
210 --to-stdout $(xml);)) | $(PERL_PATH) cat-texi.perl $@ >$@+
5cefc33b
JH
211 mv $@+ $@
212
213gitman.info: gitman.texi
9c6c304d 214 $(MAKEINFO) --no-split --no-validate $*.texi
5cefc33b
JH
215
216$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
217 $(RM) $@+ $@
218 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
219 mv $@+ $@
4739809c 220
e6fc2346 221howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
4cb08df5 222 $(RM) $@+ $@
e6fc2346
JH
223 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
224 mv $@+ $@
225
8db9307c 226$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
1187d756 227 $(ASCIIDOC) -b xhtml11 $*.txt
e6fc2346
JH
228
229WEBDOC_DEST = /pub/software/scm/git/docs
230
8d0991d7 231$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
4cb08df5 232 $(RM) $@+ $@
1187d756 233 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
8d0991d7
JH
234 mv $@+ $@
235
e6fc2346
JH
236install-webdoc : html
237 sh ./install-webdoc.sh $(WEBDOC_DEST)
6538d1ef 238
b1a46b70
MH
239quick-install: quick-install-man
240
241quick-install-man:
5682694a 242 sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
7b8a74f3 243
6fe570de
MG
244quick-install-html:
245 sh ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
246
7b8a74f3 247.PHONY: .FORCE-GIT-VERSION-FILE