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
45fd8bd3 35mandir?=$(prefix)/share/man
7b8cf0cf 36man1dir=$(mandir)/man1
4392da4d 37man5dir=$(mandir)/man5
7b8cf0cf 38man7dir=$(mandir)/man7
a682ef9f 39# DESTDIR=
87a81c83 40
1187d756 41ASCIIDOC=asciidoc
26cfcfbf 42ASCIIDOC_EXTRA =
7a2078b4 43MANPAGE_XSL = callouts.xsl
d2b8593f 44INSTALL?=install
4cb08df5 45RM ?= rm -f
6538d1ef 46DOC_REF = origin/man
6fe570de 47HTML_REF = origin/html
87a81c83 48
4739809c
DK
49infodir?=$(prefix)/share/info
50MAKEINFO=makeinfo
51INSTALL_INFO=install-info
52DOCBOOK2X_TEXI=docbook2x-texi
c680dd83
JH
53ifndef PERL_PATH
54 PERL_PATH = /usr/bin/perl
55endif
4739809c 56
95676853 57-include ../config.mak.autogen
4fa96e15 58-include ../config.mak
95676853 59
7f55cf45
JF
60ifdef ASCIIDOC8
61ASCIIDOC_EXTRA += -a asciidoc7compatible
62endif
63ifdef DOCBOOK_XSL_172
64ASCIIDOC_EXTRA += -a docbook-xsl-172
7a2078b4 65MANPAGE_XSL = manpage-1.72.xsl
7f55cf45
JF
66endif
67
b2bf34d6
DG
68#
69# Please note that there is a minor bug in asciidoc.
70# The version after 6.0.3 _will_ include the patch found here:
71# http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
72#
73# Until that version is released you may have to apply the patch
74# yourself - yes, all 6 characters of it!
75#
76
77all: html man
b790abb8
DG
78
79html: $(DOC_HTML)
80
4392da4d 81$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
b2bf34d6 82
4392da4d 83man: man1 man5 man7
b2bf34d6 84man1: $(DOC_MAN1)
4392da4d 85man5: $(DOC_MAN5)
b2bf34d6 86man7: $(DOC_MAN7)
b790abb8 87
5cefc33b 88info: git.info gitman.info
4739809c 89
b1a46b70
MH
90install: install-man
91
92install-man: man
41650765
RS
93 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
94 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
95 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
96 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
97 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
98 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
87a81c83 99
4739809c 100install-info: info
41650765 101 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
5cefc33b 102 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
4739809c
DK
103 if test -r $(DESTDIR)$(infodir)/dir; then \
104 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
5cefc33b 105 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
4739809c
DK
106 else \
107 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
108 fi
37465016 109
5d6491c7
CC
110install-html: html
111 sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
112
7b8a74f3
FL
113../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
114 $(MAKE) -C ../ GIT-VERSION-FILE
115
116-include ../GIT-VERSION-FILE
117
93d69d86
JL
118#
119# Determine "include::" file references in asciidoc files.
120#
fb612d54 121doc.dep : $(wildcard *.txt) build-docdep.perl
4cb08df5 122 $(RM) $@+ $@
c680dd83 123 $(PERL_PATH) ./build-docdep.perl >$@+
a5ae8e64 124 mv $@+ $@
93d69d86 125
a5ae8e64 126-include doc.dep
37465016 127
72fe6a59
JH
128cmds_txt = cmds-ancillaryinterrogators.txt \
129 cmds-ancillarymanipulators.txt \
130 cmds-mainporcelain.txt \
131 cmds-plumbinginterrogators.txt \
132 cmds-plumbingmanipulators.txt \
89bf2077
JH
133 cmds-synchingrepositories.txt \
134 cmds-synchelpers.txt \
135 cmds-purehelpers.txt \
136 cmds-foreignscminterface.txt
72fe6a59 137
d7907392
JH
138$(cmds_txt): cmd-list.made
139
79d30668 140cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
f9286765 141 $(RM) $@
c680dd83 142 $(PERL_PATH) ./cmd-list.perl ../command-list.txt
d7907392 143 date >$@
b790abb8
DG
144
145clean:
4c785e50
JH
146 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
147 $(RM) *.texi *.texi+ git.info gitman.info
530e741c
JH
148 $(RM) howto-index.txt howto/*.html doc.dep
149 $(RM) technical/api-*.html technical/api-index.txt
4cb08df5 150 $(RM) $(cmds_txt) *.made
b790abb8 151
530e741c 152$(MAN_HTML): %.html : %.txt
4cb08df5 153 $(RM) $@+ $@
7b8a74f3 154 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
4159c578 155 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
7b8a74f3 156 mv $@+ $@
b790abb8 157
4392da4d 158%.1 %.5 %.7 : %.xml
50cff52f 159 $(RM) $@
7a2078b4 160 xmlto -m $(MANPAGE_XSL) man $<
b790abb8
DG
161
162%.xml : %.txt
4cb08df5 163 $(RM) $@+ $@
7b8a74f3 164 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
4159c578 165 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
7b8a74f3 166 mv $@+ $@
3f971fc4 167
d19fbc3c 168user-manual.xml: user-manual.txt user-manual.conf
1187d756 169 $(ASCIIDOC) -b docbook -d book $<
d19fbc3c 170
530e741c
JH
171technical/api-index.txt: technical/api-index-skel.txt \
172 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
173 cd technical && sh ./api-index.sh
174
175$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
176 $(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
177 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
178
1cffddd6 179XSLT = docbook.xsl
0a3985dc 180XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
1c95c565 181
d19fbc3c 182user-manual.html: user-manual.xml
1c95c565 183 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
d19fbc3c 184
50b3555c
JH
185git.info: user-manual.texi
186 $(MAKEINFO) --no-split -o $@ user-manual.texi
5cefc33b 187
50b3555c 188user-manual.texi: user-manual.xml
5cefc33b
JH
189 $(RM) $@+ $@
190 $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout | $(PERL_PATH) fix-texi.perl >$@+
191 mv $@+ $@
192
193gitman.texi: $(MAN_XML) cat-texi.perl
194 $(RM) $@+ $@
195 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --to-stdout $(xml);)) | \
196 $(PERL_PATH) cat-texi.perl $@ >$@+
197 mv $@+ $@
198
199gitman.info: gitman.texi
4739809c 200 $(MAKEINFO) --no-split $*.texi
5cefc33b
JH
201
202$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
203 $(RM) $@+ $@
204 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
205 mv $@+ $@
4739809c 206
e6fc2346 207howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
4cb08df5 208 $(RM) $@+ $@
e6fc2346
JH
209 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
210 mv $@+ $@
211
8db9307c 212$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
1187d756 213 $(ASCIIDOC) -b xhtml11 $*.txt
e6fc2346
JH
214
215WEBDOC_DEST = /pub/software/scm/git/docs
216
8d0991d7 217$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
4cb08df5 218 $(RM) $@+ $@
1187d756 219 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
8d0991d7
JH
220 mv $@+ $@
221
e6fc2346
JH
222install-webdoc : html
223 sh ./install-webdoc.sh $(WEBDOC_DEST)
6538d1ef 224
b1a46b70
MH
225quick-install: quick-install-man
226
227quick-install-man:
5682694a 228 sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
7b8a74f3 229
6fe570de
MG
230quick-install-html:
231 sh ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
232
7b8a74f3 233.PHONY: .FORCE-GIT-VERSION-FILE