76a15ff520fe444fe41c46dc17cac7b5df7731d5
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
32mandir?=$(prefix)/share/man
33man1dir=$(mandir)/man1
34man5dir=$(mandir)/man5
35man7dir=$(mandir)/man7
36# DESTDIR=
37
38ASCIIDOC=asciidoc
39ASCIIDOC_EXTRA =
40ifdef ASCIIDOC8
41ASCIIDOC_EXTRA += -a asciidoc7compatible
42endif
43INSTALL?=install
44RM ?= rm -f
45DOC_REF = origin/man
46
47infodir?=$(prefix)/share/info
48MAKEINFO=makeinfo
49INSTALL_INFO=install-info
50DOCBOOK2X_TEXI=docbook2x-texi
51
52-include ../config.mak.autogen
53-include ../config.mak
54
55#
56# Please note that there is a minor bug in asciidoc.
57# The version after 6.0.3 _will_ include the patch found here:
58# http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
59#
60# Until that version is released you may have to apply the patch
61# yourself - yes, all 6 characters of it!
62#
63
64all: html man
65
66html: $(DOC_HTML)
67
68$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
69
70man: man1 man5 man7
71man1: $(DOC_MAN1)
72man5: $(DOC_MAN5)
73man7: $(DOC_MAN7)
74
75info: git.info
76
77install: man
78 $(INSTALL) -d -m755 $(DESTDIR)$(man1dir)
79 $(INSTALL) -d -m755 $(DESTDIR)$(man5dir)
80 $(INSTALL) -d -m755 $(DESTDIR)$(man7dir)
81 $(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
82 $(INSTALL) -m644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
83 $(INSTALL) -m644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
84
85install-info: info
86 $(INSTALL) -d -m755 $(DESTDIR)$(infodir)
87 $(INSTALL) -m644 git.info $(DESTDIR)$(infodir)
88 if test -r $(DESTDIR)$(infodir)/dir; then \
89 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
90 else \
91 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
92 fi
93
94../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
95 $(MAKE) -C ../ GIT-VERSION-FILE
96
97-include ../GIT-VERSION-FILE
98
99#
100# Determine "include::" file references in asciidoc files.
101#
102doc.dep : $(wildcard *.txt) build-docdep.perl
103 $(RM) $@+ $@
104 perl ./build-docdep.perl >$@+
105 mv $@+ $@
106
107-include doc.dep
108
109cmds_txt = cmds-ancillaryinterrogators.txt \
110 cmds-ancillarymanipulators.txt \
111 cmds-mainporcelain.txt \
112 cmds-plumbinginterrogators.txt \
113 cmds-plumbingmanipulators.txt \
114 cmds-synchingrepositories.txt \
115 cmds-synchelpers.txt \
116 cmds-purehelpers.txt \
117 cmds-foreignscminterface.txt
118
119$(cmds_txt): cmd-list.made
120
121cmd-list.made: cmd-list.perl $(MAN1_TXT)
122 perl ./cmd-list.perl
123 date >$@
124
125git.7 git.html: git.txt core-intro.txt
126
127clean:
128 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 *.texi *.texi+ howto-index.txt howto/*.html doc.dep
129 $(RM) $(cmds_txt) *.made
130
131%.html : %.txt
132 $(RM) $@+ $@
133 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
134 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
135 mv $@+ $@
136
137%.1 %.5 %.7 : %.xml
138 $(RM) $@
139 xmlto -m callouts.xsl man $<
140
141%.xml : %.txt
142 $(RM) $@+ $@
143 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
144 $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
145 mv $@+ $@
146
147user-manual.xml: user-manual.txt user-manual.conf
148 $(ASCIIDOC) -b docbook -d book $<
149
150XSLT = docbook.xsl
151XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
152
153user-manual.html: user-manual.xml
154 xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
155
156git.info: user-manual.xml
157 $(RM) $@ $*.texi $*.texi+
158 $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout >$*.texi+
159 perl fix-texi.perl <$*.texi+ >$*.texi
160 $(MAKEINFO) --no-split $*.texi
161 $(RM) $*.texi $*.texi+
162
163howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
164 $(RM) $@+ $@
165 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
166 mv $@+ $@
167
168$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
169 $(ASCIIDOC) -b xhtml11 $*.txt
170
171WEBDOC_DEST = /pub/software/scm/git/docs
172
173$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
174 $(RM) $@+ $@
175 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
176 mv $@+ $@
177
178install-webdoc : html
179 sh ./install-webdoc.sh $(WEBDOC_DEST)
180
181quick-install:
182 sh ./install-doc-quick.sh $(DOC_REF) $(mandir)
183
184.PHONY: .FORCE-GIT-VERSION-FILE