Code

Merge branch 'master' into cc/help
[git.git] / Documentation / Makefile
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
6 MAN7_TXT=git.txt
8 DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT))
10 ARTICLES = tutorial
11 ARTICLES += tutorial-2
12 ARTICLES += core-tutorial
13 ARTICLES += cvs-migration
14 ARTICLES += diffcore
15 ARTICLES += howto-index
16 ARTICLES += repository-layout
17 ARTICLES += hooks
18 ARTICLES += everyday
19 ARTICLES += git-tools
20 ARTICLES += glossary
21 # with their own formatting rules.
22 SP_ARTICLES = howto/revert-branch-rebase user-manual
24 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
26 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
27 DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
28 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
30 prefix?=$(HOME)
31 bindir?=$(prefix)/bin
32 htmldir?=$(prefix)/share/doc/git-doc
33 mandir?=$(prefix)/share/man
34 man1dir=$(mandir)/man1
35 man5dir=$(mandir)/man5
36 man7dir=$(mandir)/man7
37 # DESTDIR=
39 ASCIIDOC=asciidoc
40 ASCIIDOC_EXTRA =
41 INSTALL?=install
42 RM ?= rm -f
43 DOC_REF = origin/man
45 infodir?=$(prefix)/share/info
46 MAKEINFO=makeinfo
47 INSTALL_INFO=install-info
48 DOCBOOK2X_TEXI=docbook2x-texi
49 ifndef PERL_PATH
50         PERL_PATH = /usr/bin/perl
51 endif
53 -include ../config.mak.autogen
54 -include ../config.mak
56 ifdef ASCIIDOC8
57 ASCIIDOC_EXTRA += -a asciidoc7compatible
58 endif
59 ifdef DOCBOOK_XSL_172
60 ASCIIDOC_EXTRA += -a docbook-xsl-172
61 endif
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 #
72 all: html man
74 html: $(DOC_HTML)
76 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
78 man: man1 man5 man7
79 man1: $(DOC_MAN1)
80 man5: $(DOC_MAN5)
81 man7: $(DOC_MAN7)
83 info: git.info
85 install: 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)
93 install-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
102 install-html: html
103         sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
105 ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
106         $(MAKE) -C ../ GIT-VERSION-FILE
108 -include ../GIT-VERSION-FILE
111 # Determine "include::" file references in asciidoc files.
113 doc.dep : $(wildcard *.txt) build-docdep.perl
114         $(RM) $@+ $@
115         $(PERL_PATH) ./build-docdep.perl >$@+
116         mv $@+ $@
118 -include doc.dep
120 cmds_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
130 $(cmds_txt): cmd-list.made
132 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
133         $(RM) $@
134         $(PERL_PATH) ./cmd-list.perl ../command-list.txt
135         date >$@
137 git.7 git.html: git.txt
139 clean:
140         $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 *.texi *.texi+ howto-index.txt howto/*.html doc.dep
141         $(RM) $(cmds_txt) *.made
143 %.html : %.txt
144         $(RM) $@+ $@
145         $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
146                 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
147         mv $@+ $@
149 %.1 %.5 %.7 : %.xml
150         $(RM) $@
151         xmlto -m callouts.xsl man $<
153 %.xml : %.txt
154         $(RM) $@+ $@
155         $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
156                 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
157         mv $@+ $@
159 user-manual.xml: user-manual.txt user-manual.conf
160         $(ASCIIDOC) -b docbook -d book $<
162 XSLT = docbook.xsl
163 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
165 user-manual.html: user-manual.xml
166         xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
168 git.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+
175 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
176         $(RM) $@+ $@
177         sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
178         mv $@+ $@
180 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
181         $(ASCIIDOC) -b xhtml11 $*.txt
183 WEBDOC_DEST = /pub/software/scm/git/docs
185 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
186         $(RM) $@+ $@
187         sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
188         mv $@+ $@
190 install-webdoc : html
191         sh ./install-webdoc.sh $(WEBDOC_DEST)
193 quick-install:
194         sh ./install-doc-quick.sh $(DOC_REF) $(mandir)
196 .PHONY: .FORCE-GIT-VERSION-FILE