Merge branch 'master' into cc/help
[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
891dbc6e 5MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt
b2bf34d6 6MAN7_TXT=git.txt
b790abb8 7
4392da4d 8DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT))
8db9307c 9
a1d4aa74 10ARTICLES = tutorial
e31952da 11ARTICLES += tutorial-2
dcc6e28f 12ARTICLES += core-tutorial
a1d4aa74
JH
13ARTICLES += cvs-migration
14ARTICLES += diffcore
15ARTICLES += howto-index
16ARTICLES += repository-layout
6d35cc76 17ARTICLES += hooks
db9536c8 18ARTICLES += everyday
4a5d6939 19ARTICLES += git-tools
f562e6f3 20ARTICLES += glossary
8db9307c 21# with their own formatting rules.
f562e6f3 22SP_ARTICLES = howto/revert-branch-rebase user-manual
8db9307c
JH
23
24DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
789d5774 25
b2bf34d6 26DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
2d76548b 27DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
b2bf34d6
DG
28DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
29
d2b8593f 30prefix?=$(HOME)
e14421b9 31bindir?=$(prefix)/bin
5d6491c7 32htmldir?=$(prefix)/share/doc/git-doc
45fd8bd3 33mandir?=$(prefix)/share/man
7b8cf0cf 34man1dir=$(mandir)/man1
4392da4d 35man5dir=$(mandir)/man5
7b8cf0cf 36man7dir=$(mandir)/man7
a682ef9f 37# DESTDIR=
87a81c83 38
1187d756 39ASCIIDOC=asciidoc
26cfcfbf 40ASCIIDOC_EXTRA =
d2b8593f 41INSTALL?=install
4cb08df5 42RM ?= rm -f
6538d1ef 43DOC_REF = origin/man
87a81c83 44
4739809c
DK
45infodir?=$(prefix)/share/info
46MAKEINFO=makeinfo
47INSTALL_INFO=install-info
48DOCBOOK2X_TEXI=docbook2x-texi
c680dd83
JH
49ifndef PERL_PATH
50 PERL_PATH = /usr/bin/perl
51endif
4739809c 52
95676853 53-include ../config.mak.autogen
4fa96e15 54-include ../config.mak
95676853 55
7f55cf45
JF
56ifdef ASCIIDOC8
57ASCIIDOC_EXTRA += -a asciidoc7compatible
58endif
59ifdef DOCBOOK_XSL_172
60ASCIIDOC_EXTRA += -a docbook-xsl-172
61endif
62
b2bf34d6
DG
63#
64# Please note that there is a minor bug in asciidoc.
65# The version after 6.0.3 _will_ include the patch found here:
66# http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
67#
68# Until that version is released you may have to apply the patch
69# yourself - yes, all 6 characters of it!
70#
71
72all: html man
b790abb8
DG
73
74html: $(DOC_HTML)
75
4392da4d 76$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
b2bf34d6 77
4392da4d 78man: man1 man5 man7
b2bf34d6 79man1: $(DOC_MAN1)
4392da4d 80man5: $(DOC_MAN5)
b2bf34d6 81man7: $(DOC_MAN7)
b790abb8 82
4739809c
DK
83info: git.info
84
b163512d 85install: man
41650765
RS
86 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
87 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
88 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
89 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
90 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
91 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
87a81c83 92
4739809c 93install-info: info
41650765
RS
94 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
95 $(INSTALL) -m 644 git.info $(DESTDIR)$(infodir)
4739809c
DK
96 if test -r $(DESTDIR)$(infodir)/dir; then \
97 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
98 else \
99 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
100 fi
37465016 101
5d6491c7
CC
102install-html: html
103 sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
104
7b8a74f3
FL
105../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
106 $(MAKE) -C ../ GIT-VERSION-FILE
107
108-include ../GIT-VERSION-FILE
109
93d69d86
JL
110#
111# Determine "include::" file references in asciidoc files.
112#
fb612d54 113doc.dep : $(wildcard *.txt) build-docdep.perl
4cb08df5 114 $(RM) $@+ $@
c680dd83 115 $(PERL_PATH) ./build-docdep.perl >$@+
a5ae8e64 116 mv $@+ $@
93d69d86 117
a5ae8e64 118-include doc.dep
37465016 119
72fe6a59
JH
120cmds_txt = cmds-ancillaryinterrogators.txt \
121 cmds-ancillarymanipulators.txt \
122 cmds-mainporcelain.txt \
123 cmds-plumbinginterrogators.txt \
124 cmds-plumbingmanipulators.txt \
89bf2077
JH
125 cmds-synchingrepositories.txt \
126 cmds-synchelpers.txt \
127 cmds-purehelpers.txt \
128 cmds-foreignscminterface.txt
72fe6a59 129
d7907392
JH
130$(cmds_txt): cmd-list.made
131
79d30668 132cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
f9286765 133 $(RM) $@
c680dd83 134 $(PERL_PATH) ./cmd-list.perl ../command-list.txt
d7907392 135 date >$@
b790abb8 136
40dac517 137git.7 git.html: git.txt
93d69d86 138
b790abb8 139clean:
4739809c 140 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 *.texi *.texi+ howto-index.txt howto/*.html doc.dep
4cb08df5 141 $(RM) $(cmds_txt) *.made
b790abb8
DG
142
143%.html : %.txt
4cb08df5 144 $(RM) $@+ $@
7b8a74f3 145 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
4159c578 146 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
7b8a74f3 147 mv $@+ $@
b790abb8 148
4392da4d 149%.1 %.5 %.7 : %.xml
50cff52f 150 $(RM) $@
776e994a 151 xmlto -m callouts.xsl man $<
b790abb8
DG
152
153%.xml : %.txt
4cb08df5 154 $(RM) $@+ $@
7b8a74f3 155 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
4159c578 156 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
7b8a74f3 157 mv $@+ $@
3f971fc4 158
d19fbc3c 159user-manual.xml: user-manual.txt user-manual.conf
1187d756 160 $(ASCIIDOC) -b docbook -d book $<
d19fbc3c 161
1cffddd6 162XSLT = docbook.xsl
0a3985dc 163XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
1c95c565 164
d19fbc3c 165user-manual.html: user-manual.xml
1c95c565 166 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
d19fbc3c 167
4739809c
DK
168git.info: user-manual.xml
169 $(RM) $@ $*.texi $*.texi+
170 $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout >$*.texi+
c680dd83 171 $(PERL_PATH) fix-texi.perl <$*.texi+ >$*.texi
4739809c
DK
172 $(MAKEINFO) --no-split $*.texi
173 $(RM) $*.texi $*.texi+
174
e6fc2346 175howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
4cb08df5 176 $(RM) $@+ $@
e6fc2346
JH
177 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
178 mv $@+ $@
179
8db9307c 180$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
1187d756 181 $(ASCIIDOC) -b xhtml11 $*.txt
e6fc2346
JH
182
183WEBDOC_DEST = /pub/software/scm/git/docs
184
8d0991d7 185$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
4cb08df5 186 $(RM) $@+ $@
1187d756 187 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
8d0991d7
JH
188 mv $@+ $@
189
e6fc2346
JH
190install-webdoc : html
191 sh ./install-webdoc.sh $(WEBDOC_DEST)
6538d1ef
EW
192
193quick-install:
194 sh ./install-doc-quick.sh $(DOC_REF) $(mandir)
7b8a74f3
FL
195
196.PHONY: .FORCE-GIT-VERSION-FILE