Remove now unnecessary 'sync()' calls
[git/dscho.git] / Documentation / Makefile
blob9750334b9764dc5901069501fd6b6fe196d22ca5
1 MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard git-*.txt)) \
4 gitk.txt
5 MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt
6 MAN7_TXT=git.txt gitcli.txt gittutorial.txt gittutorial-2.txt \
7 gitcvs-migration.txt
9 MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
10 MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
11 MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
13 DOC_HTML=$(MAN_HTML)
15 ARTICLES = core-tutorial
16 ARTICLES += diffcore
17 ARTICLES += howto-index
18 ARTICLES += repository-layout
19 ARTICLES += everyday
20 ARTICLES += git-tools
21 ARTICLES += glossary
22 # with their own formatting rules.
23 SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
24 API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
25 SP_ARTICLES += $(API_DOCS)
26 SP_ARTICLES += technical/api-index
28 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
30 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
31 DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
32 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
34 prefix?=$(HOME)
35 bindir?=$(prefix)/bin
36 htmldir?=$(prefix)/share/doc/git-doc
37 mandir?=$(prefix)/share/man
38 man1dir=$(mandir)/man1
39 man5dir=$(mandir)/man5
40 man7dir=$(mandir)/man7
41 # DESTDIR=
43 ASCIIDOC=asciidoc
44 ASCIIDOC_EXTRA =
45 MANPAGE_XSL = callouts.xsl
46 INSTALL?=install
47 RM ?= rm -f
48 DOC_REF = origin/man
50 infodir?=$(prefix)/share/info
51 MAKEINFO=makeinfo
52 INSTALL_INFO=install-info
53 DOCBOOK2X_TEXI=docbook2x-texi
54 ifndef PERL_PATH
55 PERL_PATH = /usr/bin/perl
56 endif
58 -include ../config.mak.autogen
59 -include ../config.mak
61 ifdef ASCIIDOC8
62 ASCIIDOC_EXTRA += -a asciidoc7compatible
63 endif
64 ifdef DOCBOOK_XSL_172
65 ASCIIDOC_EXTRA += -a docbook-xsl-172
66 MANPAGE_XSL = manpage-1.72.xsl
67 endif
70 # Please note that there is a minor bug in asciidoc.
71 # The version after 6.0.3 _will_ include the patch found here:
72 # http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
74 # Until that version is released you may have to apply the patch
75 # yourself - yes, all 6 characters of it!
78 all: html man
80 html: $(DOC_HTML)
82 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
84 man: man1 man5 man7
85 man1: $(DOC_MAN1)
86 man5: $(DOC_MAN5)
87 man7: $(DOC_MAN7)
89 info: git.info gitman.info
91 install: man
92 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
93 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
94 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
95 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
96 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
97 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
99 install-info: info
100 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
101 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
102 if test -r $(DESTDIR)$(infodir)/dir; then \
103 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
104 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
105 else \
106 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
109 install-html: html
110 sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
112 ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
113 $(MAKE) -C ../ GIT-VERSION-FILE
115 -include ../GIT-VERSION-FILE
118 # Determine "include::" file references in asciidoc files.
120 doc.dep : $(wildcard *.txt) build-docdep.perl
121 $(RM) $@+ $@
122 $(PERL_PATH) ./build-docdep.perl >$@+
123 mv $@+ $@
125 -include doc.dep
127 cmds_txt = cmds-ancillaryinterrogators.txt \
128 cmds-ancillarymanipulators.txt \
129 cmds-mainporcelain.txt \
130 cmds-plumbinginterrogators.txt \
131 cmds-plumbingmanipulators.txt \
132 cmds-synchingrepositories.txt \
133 cmds-synchelpers.txt \
134 cmds-purehelpers.txt \
135 cmds-foreignscminterface.txt
137 $(cmds_txt): cmd-list.made
139 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
140 $(RM) $@
141 $(PERL_PATH) ./cmd-list.perl ../command-list.txt
142 date >$@
144 git.7 git.html: git.txt
146 clean:
147 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
148 $(RM) *.texi *.texi+ git.info gitman.info
149 $(RM) howto-index.txt howto/*.html doc.dep
150 $(RM) technical/api-*.html technical/api-index.txt
151 $(RM) $(cmds_txt) *.made
153 $(MAN_HTML): %.html : %.txt
154 $(RM) $@+ $@
155 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
156 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
157 mv $@+ $@
159 %.1 %.5 %.7 : %.xml
160 $(RM) $@
161 xmlto -m $(MANPAGE_XSL) man $<
163 %.xml : %.txt
164 $(RM) $@+ $@
165 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
166 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
167 mv $@+ $@
169 user-manual.xml: user-manual.txt user-manual.conf
170 $(ASCIIDOC) -b docbook -d book $<
172 technical/api-index.txt: technical/api-index-skel.txt \
173 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
174 cd technical && sh ./api-index.sh
176 $(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
177 $(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
178 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
180 XSLT = docbook.xsl
181 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
183 user-manual.html: user-manual.xml
184 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
186 git.info: user-manual.texi
187 $(MAKEINFO) --no-split -o $@ user-manual.texi
189 user-manual.texi: user-manual.xml
190 $(RM) $@+ $@
191 $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout | $(PERL_PATH) fix-texi.perl >$@+
192 mv $@+ $@
194 gitman.texi: $(MAN_XML) cat-texi.perl
195 $(RM) $@+ $@
196 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --to-stdout $(xml);)) | \
197 $(PERL_PATH) cat-texi.perl $@ >$@+
198 mv $@+ $@
200 gitman.info: gitman.texi
201 $(MAKEINFO) --no-split $*.texi
203 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
204 $(RM) $@+ $@
205 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
206 mv $@+ $@
208 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
209 $(RM) $@+ $@
210 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
211 mv $@+ $@
213 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
214 $(ASCIIDOC) -b xhtml11 $*.txt
216 WEBDOC_DEST = /pub/software/scm/git/docs
218 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
219 $(RM) $@+ $@
220 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
221 mv $@+ $@
223 install-webdoc : html
224 sh ./install-webdoc.sh $(WEBDOC_DEST)
226 quick-install:
227 sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
229 .PHONY: .FORCE-GIT-VERSION-FILE