add test-dump-cache-tree in Makefile
[alt-git.git] / Documentation / Makefile
blob62269e39c4edf95b2cf2e6a60bff2a33b239b07e
1 MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard git-*.txt)) \
4 gitk.txt git.txt
5 MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \
6 gitrepository-layout.txt
7 MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \
8 gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt \
9 gitdiffcore.txt
11 MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
12 MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
13 MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
15 DOC_HTML=$(MAN_HTML)
17 ARTICLES = howto-index
18 ARTICLES += everyday
19 ARTICLES += git-tools
20 # with their own formatting rules.
21 SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
22 API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
23 SP_ARTICLES += $(API_DOCS)
24 SP_ARTICLES += technical/api-index
26 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
28 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
29 DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
30 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
32 prefix?=$(HOME)
33 bindir?=$(prefix)/bin
34 htmldir?=$(prefix)/share/doc/git-doc
35 mandir?=$(prefix)/share/man
36 man1dir=$(mandir)/man1
37 man5dir=$(mandir)/man5
38 man7dir=$(mandir)/man7
39 # DESTDIR=
41 ASCIIDOC=asciidoc
42 ASCIIDOC_EXTRA =
43 MANPAGE_XSL = callouts.xsl
44 INSTALL?=install
45 RM ?= rm -f
46 DOC_REF = origin/man
48 infodir?=$(prefix)/share/info
49 MAKEINFO=makeinfo
50 INSTALL_INFO=install-info
51 DOCBOOK2X_TEXI=docbook2x-texi
52 ifndef PERL_PATH
53 PERL_PATH = /usr/bin/perl
54 endif
56 -include ../config.mak.autogen
57 -include ../config.mak
59 ifdef ASCIIDOC8
60 ASCIIDOC_EXTRA += -a asciidoc7compatible
61 endif
62 ifdef DOCBOOK_XSL_172
63 ASCIIDOC_EXTRA += -a docbook-xsl-172
64 MANPAGE_XSL = manpage-1.72.xsl
65 endif
68 # Please note that there is a minor bug in asciidoc.
69 # The version after 6.0.3 _will_ include the patch found here:
70 # http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
72 # Until that version is released you may have to apply the patch
73 # yourself - yes, all 6 characters of it!
76 all: html man
78 html: $(DOC_HTML)
80 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
82 man: man1 man5 man7
83 man1: $(DOC_MAN1)
84 man5: $(DOC_MAN5)
85 man7: $(DOC_MAN7)
87 info: git.info gitman.info
89 install: man
90 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
91 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
92 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
93 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
94 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
95 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
97 install-info: info
98 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
99 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
100 if test -r $(DESTDIR)$(infodir)/dir; then \
101 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
102 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
103 else \
104 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
107 install-html: html
108 sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
110 ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
111 $(MAKE) -C ../ GIT-VERSION-FILE
113 -include ../GIT-VERSION-FILE
116 # Determine "include::" file references in asciidoc files.
118 doc.dep : $(wildcard *.txt) build-docdep.perl
119 $(RM) $@+ $@
120 $(PERL_PATH) ./build-docdep.perl >$@+
121 mv $@+ $@
123 -include doc.dep
125 cmds_txt = cmds-ancillaryinterrogators.txt \
126 cmds-ancillarymanipulators.txt \
127 cmds-mainporcelain.txt \
128 cmds-plumbinginterrogators.txt \
129 cmds-plumbingmanipulators.txt \
130 cmds-synchingrepositories.txt \
131 cmds-synchelpers.txt \
132 cmds-purehelpers.txt \
133 cmds-foreignscminterface.txt
135 $(cmds_txt): cmd-list.made
137 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
138 $(RM) $@
139 $(PERL_PATH) ./cmd-list.perl ../command-list.txt
140 date >$@
142 clean:
143 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
144 $(RM) *.texi *.texi+ git.info gitman.info
145 $(RM) howto-index.txt howto/*.html doc.dep
146 $(RM) technical/api-*.html technical/api-index.txt
147 $(RM) $(cmds_txt) *.made
149 $(MAN_HTML): %.html : %.txt
150 $(RM) $@+ $@
151 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
152 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
153 mv $@+ $@
155 %.1 %.5 %.7 : %.xml
156 $(RM) $@
157 xmlto -m $(MANPAGE_XSL) man $<
159 %.xml : %.txt
160 $(RM) $@+ $@
161 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
162 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
163 mv $@+ $@
165 user-manual.xml: user-manual.txt user-manual.conf
166 $(ASCIIDOC) -b docbook -d book $<
168 technical/api-index.txt: technical/api-index-skel.txt \
169 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
170 cd technical && sh ./api-index.sh
172 $(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
173 $(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
174 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
176 XSLT = docbook.xsl
177 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
179 user-manual.html: user-manual.xml
180 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
182 git.info: user-manual.texi
183 $(MAKEINFO) --no-split -o $@ user-manual.texi
185 user-manual.texi: user-manual.xml
186 $(RM) $@+ $@
187 $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout | $(PERL_PATH) fix-texi.perl >$@+
188 mv $@+ $@
190 gitman.texi: $(MAN_XML) cat-texi.perl
191 $(RM) $@+ $@
192 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --to-stdout $(xml);)) | \
193 $(PERL_PATH) cat-texi.perl $@ >$@+
194 mv $@+ $@
196 gitman.info: gitman.texi
197 $(MAKEINFO) --no-split $*.texi
199 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
200 $(RM) $@+ $@
201 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
202 mv $@+ $@
204 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
205 $(RM) $@+ $@
206 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
207 mv $@+ $@
209 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
210 $(ASCIIDOC) -b xhtml11 $*.txt
212 WEBDOC_DEST = /pub/software/scm/git/docs
214 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
215 $(RM) $@+ $@
216 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
217 mv $@+ $@
219 install-webdoc : html
220 sh ./install-webdoc.sh $(WEBDOC_DEST)
222 quick-install:
223 sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
225 .PHONY: .FORCE-GIT-VERSION-FILE