t4200: use cut instead of sed
[git/peff.git] / Documentation / Makefile
blob43781fb2486eefb09d9249150c15e286a3668b55
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 gitcli.txt gitmodules.txt
6 MAN7_TXT=git.txt
8 MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
9 MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
10 MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
12 DOC_HTML=$(MAN_HTML)
14 ARTICLES = tutorial
15 ARTICLES += tutorial-2
16 ARTICLES += core-tutorial
17 ARTICLES += cvs-migration
18 ARTICLES += diffcore
19 ARTICLES += howto-index
20 ARTICLES += repository-layout
21 ARTICLES += hooks
22 ARTICLES += everyday
23 ARTICLES += git-tools
24 ARTICLES += glossary
25 # with their own formatting rules.
26 SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
27 API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
28 SP_ARTICLES += $(API_DOCS)
29 SP_ARTICLES += technical/api-index
31 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
33 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
34 DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
35 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
37 prefix?=$(HOME)
38 bindir?=$(prefix)/bin
39 htmldir?=$(prefix)/share/doc/git-doc
40 mandir?=$(prefix)/share/man
41 man1dir=$(mandir)/man1
42 man5dir=$(mandir)/man5
43 man7dir=$(mandir)/man7
44 # DESTDIR=
46 ASCIIDOC=asciidoc
47 ASCIIDOC_EXTRA =
48 MANPAGE_XSL = callouts.xsl
49 INSTALL?=install
50 RM ?= rm -f
51 DOC_REF = origin/man
53 infodir?=$(prefix)/share/info
54 MAKEINFO=makeinfo
55 INSTALL_INFO=install-info
56 DOCBOOK2X_TEXI=docbook2x-texi
57 ifndef PERL_PATH
58 PERL_PATH = /usr/bin/perl
59 endif
61 -include ../config.mak.autogen
62 -include ../config.mak
64 ifdef ASCIIDOC8
65 ASCIIDOC_EXTRA += -a asciidoc7compatible
66 endif
67 ifdef DOCBOOK_XSL_172
68 ASCIIDOC_EXTRA += -a docbook-xsl-172
69 MANPAGE_XSL = manpage-1.72.xsl
70 endif
73 # Please note that there is a minor bug in asciidoc.
74 # The version after 6.0.3 _will_ include the patch found here:
75 # http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
77 # Until that version is released you may have to apply the patch
78 # yourself - yes, all 6 characters of it!
81 all: html man
83 html: $(DOC_HTML)
85 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
87 man: man1 man5 man7
88 man1: $(DOC_MAN1)
89 man5: $(DOC_MAN5)
90 man7: $(DOC_MAN7)
92 info: git.info gitman.info
94 install: man
95 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
96 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
97 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
98 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
99 $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
100 $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
102 install-info: info
103 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
104 $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
105 if test -r $(DESTDIR)$(infodir)/dir; then \
106 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
107 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
108 else \
109 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
112 install-html: html
113 sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
115 ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
116 $(MAKE) -C ../ GIT-VERSION-FILE
118 -include ../GIT-VERSION-FILE
121 # Determine "include::" file references in asciidoc files.
123 doc.dep : $(wildcard *.txt) build-docdep.perl
124 $(RM) $@+ $@
125 $(PERL_PATH) ./build-docdep.perl >$@+
126 mv $@+ $@
128 -include doc.dep
130 cmds_txt = cmds-ancillaryinterrogators.txt \
131 cmds-ancillarymanipulators.txt \
132 cmds-mainporcelain.txt \
133 cmds-plumbinginterrogators.txt \
134 cmds-plumbingmanipulators.txt \
135 cmds-synchingrepositories.txt \
136 cmds-synchelpers.txt \
137 cmds-purehelpers.txt \
138 cmds-foreignscminterface.txt
140 $(cmds_txt): cmd-list.made
142 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
143 $(RM) $@
144 $(PERL_PATH) ./cmd-list.perl ../command-list.txt
145 date >$@
147 git.7 git.html: git.txt
149 clean:
150 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
151 $(RM) *.texi *.texi+ git.info gitman.info
152 $(RM) howto-index.txt howto/*.html doc.dep
153 $(RM) technical/api-*.html technical/api-index.txt
154 $(RM) $(cmds_txt) *.made
156 $(MAN_HTML): %.html : %.txt
157 $(RM) $@+ $@
158 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
159 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
160 mv $@+ $@
162 %.1 %.5 %.7 : %.xml
163 $(RM) $@
164 xmlto -m $(MANPAGE_XSL) man $<
166 %.xml : %.txt
167 $(RM) $@+ $@
168 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
169 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
170 mv $@+ $@
172 user-manual.xml: user-manual.txt user-manual.conf
173 $(ASCIIDOC) -b docbook -d book $<
175 technical/api-index.txt: technical/api-index-skel.txt \
176 technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
177 cd technical && sh ./api-index.sh
179 $(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
180 $(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
181 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
183 XSLT = docbook.xsl
184 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
186 user-manual.html: user-manual.xml
187 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
189 git.info: user-manual.texi
190 $(MAKEINFO) --no-split -o $@ user-manual.texi
192 user-manual.texi: user-manual.xml
193 $(RM) $@+ $@
194 $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout | $(PERL_PATH) fix-texi.perl >$@+
195 mv $@+ $@
197 gitman.texi: $(MAN_XML) cat-texi.perl
198 $(RM) $@+ $@
199 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --to-stdout $(xml);)) | \
200 $(PERL_PATH) cat-texi.perl $@ >$@+
201 mv $@+ $@
203 gitman.info: gitman.texi
204 $(MAKEINFO) --no-split $*.texi
206 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
207 $(RM) $@+ $@
208 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
209 mv $@+ $@
211 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
212 $(RM) $@+ $@
213 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
214 mv $@+ $@
216 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
217 $(ASCIIDOC) -b xhtml11 $*.txt
219 WEBDOC_DEST = /pub/software/scm/git/docs
221 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
222 $(RM) $@+ $@
223 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
224 mv $@+ $@
226 install-webdoc : html
227 sh ./install-webdoc.sh $(WEBDOC_DEST)
229 quick-install:
230 sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
232 .PHONY: .FORCE-GIT-VERSION-FILE