1MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard git-*.txt)) \
4 gitk.txt
5MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt
6MAN7_TXT=git.txt
7
8DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT))
9
10ARTICLES = tutorial
11ARTICLES += tutorial-2
12ARTICLES += core-tutorial
13ARTICLES += cvs-migration
14ARTICLES += diffcore
15ARTICLES += howto-index
16ARTICLES += repository-layout
17ARTICLES += hooks
18ARTICLES += everyday
19ARTICLES += git-tools
20ARTICLES += glossary
21# with their own formatting rules.
22SP_ARTICLES = howto/revert-branch-rebase user-manual
23
24DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
25
26DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
27DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
28DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
29
30prefix?=$(HOME)
31bindir?=$(prefix)/bin
32htmldir?=$(prefix)/share/doc/git-doc
33mandir?=$(prefix)/share/man
34man1dir=$(mandir)/man1
35man5dir=$(mandir)/man5
36man7dir=$(mandir)/man7
37# DESTDIR=
38
39ASCIIDOC=asciidoc
40ASCIIDOC_EXTRA =
41INSTALL?=install
42RM ?= rm -f
43DOC_REF = origin/man
44
45infodir?=$(prefix)/share/info
46MAKEINFO=makeinfo
47INSTALL_INFO=install-info
48DOCBOOK2X_TEXI=docbook2x-texi
49ifndef PERL_PATH
50 PERL_PATH = /usr/bin/perl
51endif
52
53-include ../config.mak.autogen
54-include ../config.mak
55
56ifdef ASCIIDOC8
57ASCIIDOC_EXTRA += -a asciidoc7compatible
58endif
59ifdef DOCBOOK_XSL_172
60ASCIIDOC_EXTRA += -a docbook-xsl-172
61endif
62
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
73
74html: $(DOC_HTML)
75
76$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
77
78man: man1 man5 man7
79man1: $(DOC_MAN1)
80man5: $(DOC_MAN5)
81man7: $(DOC_MAN7)
82
83info: git.info
84
85install: man
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)
92
93install-info: info
94 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
95 $(INSTALL) -m 644 git.info $(DESTDIR)$(infodir)
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
101
102install-html: html
103 sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
104
105../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
106 $(MAKE) -C ../ GIT-VERSION-FILE
107
108-include ../GIT-VERSION-FILE
109
110#
111# Determine "include::" file references in asciidoc files.
112#
113doc.dep : $(wildcard *.txt) build-docdep.perl
114 $(RM) $@+ $@
115 $(PERL_PATH) ./build-docdep.perl >$@+
116 mv $@+ $@
117
118-include doc.dep
119
120cmds_txt = cmds-ancillaryinterrogators.txt \
121 cmds-ancillarymanipulators.txt \
122 cmds-mainporcelain.txt \
123 cmds-plumbinginterrogators.txt \
124 cmds-plumbingmanipulators.txt \
125 cmds-synchingrepositories.txt \
126 cmds-synchelpers.txt \
127 cmds-purehelpers.txt \
128 cmds-foreignscminterface.txt
129
130$(cmds_txt): cmd-list.made
131
132cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
133 $(RM) $@
134 $(PERL_PATH) ./cmd-list.perl ../command-list.txt
135 date >$@
136
137git.7 git.html: git.txt
138
139clean:
140 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 *.texi *.texi+ howto-index.txt howto/*.html doc.dep
141 $(RM) $(cmds_txt) *.made
142
143%.html : %.txt
144 $(RM) $@+ $@
145 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
146 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
147 mv $@+ $@
148
149%.1 %.5 %.7 : %.xml
150 $(RM) $@
151 xmlto -m callouts.xsl man $<
152
153%.xml : %.txt
154 $(RM) $@+ $@
155 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
156 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
157 mv $@+ $@
158
159user-manual.xml: user-manual.txt user-manual.conf
160 $(ASCIIDOC) -b docbook -d book $<
161
162XSLT = docbook.xsl
163XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
164
165user-manual.html: user-manual.xml
166 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
167
168git.info: user-manual.xml
169 $(RM) $@ $*.texi $*.texi+
170 $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout >$*.texi+
171 $(PERL_PATH) fix-texi.perl <$*.texi+ >$*.texi
172 $(MAKEINFO) --no-split $*.texi
173 $(RM) $*.texi $*.texi+
174
175howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
176 $(RM) $@+ $@
177 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
178 mv $@+ $@
179
180$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
181 $(ASCIIDOC) -b xhtml11 $*.txt
182
183WEBDOC_DEST = /pub/software/scm/git/docs
184
185$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
186 $(RM) $@+ $@
187 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
188 mv $@+ $@
189
190install-webdoc : html
191 sh ./install-webdoc.sh $(WEBDOC_DEST)
192
193quick-install:
194 sh ./install-doc-quick.sh $(DOC_REF) $(mandir)
195
196.PHONY: .FORCE-GIT-VERSION-FILE