Add using merge subtree How-To
[git/git.git] / Documentation / Makefile
CommitLineData
4a5d6939
MW
1MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard git-*.txt)) \
4 gitk.txt
2f7ee089 5MAN5_TXT=gitattributes.txt gitignore.txt gitcli.txt gitmodules.txt
b2bf34d6 6MAN7_TXT=git.txt
b790abb8 7
5cefc33b
JH
8MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
9MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
10MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
11
12DOC_HTML=$(MAN_HTML)
8db9307c 13
a1d4aa74 14ARTICLES = tutorial
e31952da 15ARTICLES += tutorial-2
dcc6e28f 16ARTICLES += core-tutorial
a1d4aa74
JH
17ARTICLES += cvs-migration
18ARTICLES += diffcore
19ARTICLES += howto-index
20ARTICLES += repository-layout
6d35cc76 21ARTICLES += hooks
db9536c8 22ARTICLES += everyday
4a5d6939 23ARTICLES += git-tools
f562e6f3 24ARTICLES += glossary
8db9307c 25# with their own formatting rules.
471a5ce5 26SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
530e741c
JH
27API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
28SP_ARTICLES += $(API_DOCS)
29SP_ARTICLES += technical/api-index
8db9307c
JH
30
31DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
789d5774 32
b2bf34d6 33DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
2d76548b 34DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
b2bf34d6
DG
35DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
36
d2b8593f 37prefix?=$(HOME)
e14421b9 38bindir?=$(prefix)/bin
5d6491c7 39htmldir?=$(prefix)/share/doc/git-doc
45fd8bd3 40mandir?=$(prefix)/share/man
7b8cf0cf 41man1dir=$(mandir)/man1
4392da4d 42man5dir=$(mandir)/man5
7b8cf0cf 43man7dir=$(mandir)/man7
a682ef9f 44# DESTDIR=
87a81c83 45
1187d756 46ASCIIDOC=asciidoc
26cfcfbf 47ASCIIDOC_EXTRA =
d2b8593f 48INSTALL?=install
4cb08df5 49RM ?= rm -f
6538d1ef 50DOC_REF = origin/man
87a81c83 51
4739809c
DK
52infodir?=$(prefix)/share/info
53MAKEINFO=makeinfo
54INSTALL_INFO=install-info
55DOCBOOK2X_TEXI=docbook2x-texi
c680dd83
JH
56ifndef PERL_PATH
57 PERL_PATH = /usr/bin/perl
58endif
4739809c 59
95676853 60-include ../config.mak.autogen
4fa96e15 61-include ../config.mak
95676853 62
7f55cf45
JF
63ifdef ASCIIDOC8
64ASCIIDOC_EXTRA += -a asciidoc7compatible
65endif
66ifdef DOCBOOK_XSL_172
67ASCIIDOC_EXTRA += -a docbook-xsl-172
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
b163512d 92install: 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 144
40dac517 145git.7 git.html: git.txt
93d69d86 146
b790abb8 147clean:
4c785e50
JH
148 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
149 $(RM) *.texi *.texi+ git.info gitman.info
530e741c
JH
150 $(RM) howto-index.txt howto/*.html doc.dep
151 $(RM) technical/api-*.html technical/api-index.txt
4cb08df5 152 $(RM) $(cmds_txt) *.made
b790abb8 153
530e741c 154$(MAN_HTML): %.html : %.txt
4cb08df5 155 $(RM) $@+ $@
7b8a74f3 156 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
4159c578 157 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
7b8a74f3 158 mv $@+ $@
b790abb8 159
4392da4d 160%.1 %.5 %.7 : %.xml
50cff52f 161 $(RM) $@
776e994a 162 xmlto -m callouts.xsl man $<
b790abb8
DG
163
164%.xml : %.txt
4cb08df5 165 $(RM) $@+ $@
7b8a74f3 166 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
4159c578 167 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
7b8a74f3 168 mv $@+ $@
3f971fc4 169
d19fbc3c 170user-manual.xml: user-manual.txt user-manual.conf
1187d756 171 $(ASCIIDOC) -b docbook -d book $<
d19fbc3c 172
530e741c
JH
173technical/api-index.txt: technical/api-index-skel.txt \
174 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
175 cd technical && sh ./api-index.sh
176
177$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
178 $(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
179 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
180
1cffddd6 181XSLT = docbook.xsl
0a3985dc 182XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
1c95c565 183
d19fbc3c 184user-manual.html: user-manual.xml
1c95c565 185 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
d19fbc3c 186
50b3555c
JH
187git.info: user-manual.texi
188 $(MAKEINFO) --no-split -o $@ user-manual.texi
5cefc33b 189
50b3555c 190user-manual.texi: user-manual.xml
5cefc33b
JH
191 $(RM) $@+ $@
192 $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout | $(PERL_PATH) fix-texi.perl >$@+
193 mv $@+ $@
194
195gitman.texi: $(MAN_XML) cat-texi.perl
196 $(RM) $@+ $@
197 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --to-stdout $(xml);)) | \
198 $(PERL_PATH) cat-texi.perl $@ >$@+
199 mv $@+ $@
200
201gitman.info: gitman.texi
4739809c 202 $(MAKEINFO) --no-split $*.texi
5cefc33b
JH
203
204$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
205 $(RM) $@+ $@
206 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
207 mv $@+ $@
4739809c 208
e6fc2346 209howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
4cb08df5 210 $(RM) $@+ $@
e6fc2346
JH
211 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
212 mv $@+ $@
213
8db9307c 214$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
1187d756 215 $(ASCIIDOC) -b xhtml11 $*.txt
e6fc2346
JH
216
217WEBDOC_DEST = /pub/software/scm/git/docs
218
8d0991d7 219$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
4cb08df5 220 $(RM) $@+ $@
1187d756 221 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
8d0991d7
JH
222 mv $@+ $@
223
e6fc2346
JH
224install-webdoc : html
225 sh ./install-webdoc.sh $(WEBDOC_DEST)
6538d1ef
EW
226
227quick-install:
5682694a 228 sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
7b8a74f3
FL
229
230.PHONY: .FORCE-GIT-VERSION-FILE