]>
Commit | Line | Data |
---|---|---|
4a5d6939 MW |
1 | MAN1_TXT= \ |
2 | $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \ | |
3 | $(wildcard git-*.txt)) \ | |
9e1f0a85 | 4 | gitk.txt git.txt |
30eba7bf CC |
5 | MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \ |
6 | gitrepository-layout.txt | |
9e1f0a85 | 7 | MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \ |
30eba7bf | 8 | gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt \ |
f948dd89 | 9 | gitdiffcore.txt gitworkflows.txt |
b790abb8 | 10 | |
5cefc33b JH |
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)) | |
14 | ||
15 | DOC_HTML=$(MAN_HTML) | |
8db9307c | 16 | |
30eba7bf | 17 | ARTICLES = howto-index |
db9536c8 | 18 | ARTICLES += everyday |
4a5d6939 | 19 | ARTICLES += git-tools |
8db9307c | 20 | # with their own formatting rules. |
471a5ce5 | 21 | SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual |
530e741c JH |
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 | |
8db9307c JH |
25 | |
26 | DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES)) | |
789d5774 | 27 | |
b2bf34d6 | 28 | DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT)) |
2d76548b | 29 | DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT)) |
b2bf34d6 DG |
30 | DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT)) |
31 | ||
d2b8593f | 32 | prefix?=$(HOME) |
e14421b9 | 33 | bindir?=$(prefix)/bin |
5d6491c7 | 34 | htmldir?=$(prefix)/share/doc/git-doc |
a325a1a7 | 35 | pdfdir?=$(prefix)/share/doc/git-doc |
45fd8bd3 | 36 | mandir?=$(prefix)/share/man |
7b8cf0cf | 37 | man1dir=$(mandir)/man1 |
4392da4d | 38 | man5dir=$(mandir)/man5 |
7b8cf0cf | 39 | man7dir=$(mandir)/man7 |
a682ef9f | 40 | # DESTDIR= |
87a81c83 | 41 | |
1187d756 | 42 | ASCIIDOC=asciidoc |
26cfcfbf | 43 | ASCIIDOC_EXTRA = |
c30e9485 | 44 | MANPAGE_XSL = manpage-normal.xsl |
5121a6d9 | 45 | XMLTO_EXTRA = |
d2b8593f | 46 | INSTALL?=install |
4cb08df5 | 47 | RM ?= rm -f |
6538d1ef | 48 | DOC_REF = origin/man |
6fe570de | 49 | HTML_REF = origin/html |
87a81c83 | 50 | |
4739809c DK |
51 | infodir?=$(prefix)/share/info |
52 | MAKEINFO=makeinfo | |
53 | INSTALL_INFO=install-info | |
54 | DOCBOOK2X_TEXI=docbook2x-texi | |
a325a1a7 | 55 | DBLATEX=dblatex |
c680dd83 JH |
56 | ifndef PERL_PATH |
57 | PERL_PATH = /usr/bin/perl | |
58 | endif | |
4739809c | 59 | |
95676853 | 60 | -include ../config.mak.autogen |
4fa96e15 | 61 | -include ../config.mak |
95676853 | 62 | |
8fa2b45f CJ |
63 | # |
64 | # For asciidoc ... | |
65 | # -7.1.2, no extra settings are needed. | |
66 | # 8.0-, set ASCIIDOC8. | |
67 | # | |
68 | ||
69 | # | |
70 | # For docbook-xsl ... | |
71 | # -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0) | |
2346431e CJ |
72 | # 1.69.0, no extra settings are needed? |
73 | # 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP? | |
74 | # 1.71.1, no extra settings are needed? | |
8fa2b45f CJ |
75 | # 1.72.0, set DOCBOOK_XSL_172. |
76 | # 1.73.0-, set ASCIIDOC_NO_ROFF | |
77 | # | |
78 | ||
79 | # | |
80 | # If you had been using DOCBOOK_XSL_172 in an attempt to get rid | |
81 | # of 'the ".ft C" problem' in your generated manpages, and you | |
82 | # instead ended up with weird characters around callouts, try | |
83 | # using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8). | |
84 | # | |
85 | ||
7f55cf45 | 86 | ifdef ASCIIDOC8 |
71c020c5 | 87 | ASCIIDOC_EXTRA += -a asciidoc7compatible -a no-inline-literal |
7f55cf45 JF |
88 | endif |
89 | ifdef DOCBOOK_XSL_172 | |
8fa2b45f | 90 | ASCIIDOC_EXTRA += -a git-asciidoc-no-roff |
7a2078b4 | 91 | MANPAGE_XSL = manpage-1.72.xsl |
8fa2b45f CJ |
92 | else |
93 | ifdef ASCIIDOC_NO_ROFF | |
94 | # docbook-xsl after 1.72 needs the regular XSL, but will not | |
95 | # pass-thru raw roff codes from asciidoc.conf, so turn them off. | |
96 | ASCIIDOC_EXTRA += -a git-asciidoc-no-roff | |
97 | endif | |
7f55cf45 | 98 | endif |
5121a6d9 CJ |
99 | ifdef MAN_BOLD_LITERAL |
100 | XMLTO_EXTRA += -m manpage-bold-literal.xsl | |
101 | endif | |
2346431e CJ |
102 | ifdef DOCBOOK_SUPPRESS_SP |
103 | XMLTO_EXTRA += -m manpage-suppress-sp.xsl | |
104 | endif | |
7f55cf45 | 105 | |
8dd35c71 JH |
106 | # Newer DocBook stylesheet emits warning cruft in the output when |
107 | # this is not set, and if set it shows an absolute link. We can | |
108 | # use MAN_BASE_URL=http://www.kernel.org/pub/software/scm/git/docs/ | |
109 | # but distros may want to set it to /usr/share/doc/git-core/docs/ or | |
110 | # something like that. | |
59a0a0bd JH |
111 | # |
112 | # As older stylesheets simply ignore this parameter, it ought to be | |
113 | # safe to set it to empty string when the base URL is not specified, | |
114 | # but unfortunately we cannot do so unconditionally because at least | |
115 | # xmlto 0.0.18 is reported to lack --stringparam option. | |
116 | ifdef MAN_BASE_URL | |
a479a564 | 117 | XMLTO_EXTRA += --stringparam man.base.url.for.relative.links=$(MAN_BASE_URL) |
59a0a0bd | 118 | endif |
a479a564 | 119 | |
204d363f TR |
120 | # If your target system uses GNU groff, it may try to render |
121 | # apostrophes as a "pretty" apostrophe using unicode. This breaks | |
122 | # cut&paste, so you should set GNU_ROFF to force them to be ASCII | |
123 | # apostrophes. Unfortunately does not work with non-GNU roff. | |
124 | ifdef GNU_ROFF | |
125 | XMLTO_EXTRA += -m manpage-quote-apos.xsl | |
126 | endif | |
127 | ||
ee7ec2f9 BW |
128 | SHELL_PATH ?= $(SHELL) |
129 | # Shell quote; | |
130 | SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) | |
131 | ||
b2bf34d6 DG |
132 | # |
133 | # Please note that there is a minor bug in asciidoc. | |
134 | # The version after 6.0.3 _will_ include the patch found here: | |
135 | # http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2 | |
136 | # | |
137 | # Until that version is released you may have to apply the patch | |
138 | # yourself - yes, all 6 characters of it! | |
139 | # | |
140 | ||
bb230097 CJ |
141 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir |
142 | QUIET_SUBDIR1 = | |
143 | ||
144 | ifneq ($(findstring $(MAKEFLAGS),w),w) | |
145 | PRINT_DIR = --no-print-directory | |
146 | else # "make -w" | |
147 | NO_SUBDIR = : | |
148 | endif | |
149 | ||
150 | ifneq ($(findstring $(MAKEFLAGS),s),s) | |
151 | ifndef V | |
152 | QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@; | |
153 | QUIET_XMLTO = @echo ' ' XMLTO $@; | |
154 | QUIET_DB2TEXI = @echo ' ' DB2TEXI $@; | |
155 | QUIET_MAKEINFO = @echo ' ' MAKEINFO $@; | |
156 | QUIET_DBLATEX = @echo ' ' DBLATEX $@; | |
157 | QUIET_XSLTPROC = @echo ' ' XSLTPROC $@; | |
158 | QUIET_GEN = @echo ' ' GEN $@; | |
159 | QUIET_STDERR = 2> /dev/null | |
160 | QUIET_SUBDIR0 = +@subdir= | |
161 | QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ | |
162 | $(MAKE) $(PRINT_DIR) -C $$subdir | |
163 | export V | |
164 | endif | |
165 | endif | |
166 | ||
b2bf34d6 | 167 | all: html man |
b790abb8 DG |
168 | |
169 | html: $(DOC_HTML) | |
170 | ||
4392da4d | 171 | $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf |
b2bf34d6 | 172 | |
4392da4d | 173 | man: man1 man5 man7 |
b2bf34d6 | 174 | man1: $(DOC_MAN1) |
4392da4d | 175 | man5: $(DOC_MAN5) |
b2bf34d6 | 176 | man7: $(DOC_MAN7) |
b790abb8 | 177 | |
5cefc33b | 178 | info: git.info gitman.info |
4739809c | 179 | |
a325a1a7 MV |
180 | pdf: user-manual.pdf |
181 | ||
b1a46b70 MH |
182 | install: install-man |
183 | ||
184 | install-man: man | |
41650765 RS |
185 | $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir) |
186 | $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir) | |
187 | $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir) | |
188 | $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir) | |
189 | $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir) | |
190 | $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir) | |
87a81c83 | 191 | |
4739809c | 192 | install-info: info |
41650765 | 193 | $(INSTALL) -d -m 755 $(DESTDIR)$(infodir) |
5cefc33b | 194 | $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir) |
4739809c DK |
195 | if test -r $(DESTDIR)$(infodir)/dir; then \ |
196 | $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\ | |
5cefc33b | 197 | $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\ |
4739809c DK |
198 | else \ |
199 | echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \ | |
200 | fi | |
37465016 | 201 | |
a325a1a7 MV |
202 | install-pdf: pdf |
203 | $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir) | |
204 | $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir) | |
205 | ||
5d6491c7 | 206 | install-html: html |
ee7ec2f9 | 207 | '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir) |
5d6491c7 | 208 | |
7b8a74f3 | 209 | ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE |
bb230097 | 210 | $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE |
7b8a74f3 FL |
211 | |
212 | -include ../GIT-VERSION-FILE | |
213 | ||
93d69d86 JL |
214 | # |
215 | # Determine "include::" file references in asciidoc files. | |
216 | # | |
fb612d54 | 217 | doc.dep : $(wildcard *.txt) build-docdep.perl |
bb230097 CJ |
218 | $(QUIET_GEN)$(RM) $@+ $@ && \ |
219 | $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \ | |
a5ae8e64 | 220 | mv $@+ $@ |
93d69d86 | 221 | |
a5ae8e64 | 222 | -include doc.dep |
37465016 | 223 | |
72fe6a59 JH |
224 | cmds_txt = cmds-ancillaryinterrogators.txt \ |
225 | cmds-ancillarymanipulators.txt \ | |
226 | cmds-mainporcelain.txt \ | |
227 | cmds-plumbinginterrogators.txt \ | |
228 | cmds-plumbingmanipulators.txt \ | |
89bf2077 JH |
229 | cmds-synchingrepositories.txt \ |
230 | cmds-synchelpers.txt \ | |
231 | cmds-purehelpers.txt \ | |
232 | cmds-foreignscminterface.txt | |
72fe6a59 | 233 | |
d7907392 JH |
234 | $(cmds_txt): cmd-list.made |
235 | ||
79d30668 | 236 | cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT) |
bb230097 CJ |
237 | $(QUIET_GEN)$(RM) $@ && \ |
238 | $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \ | |
d7907392 | 239 | date >$@ |
b790abb8 DG |
240 | |
241 | clean: | |
4c785e50 | 242 | $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 |
c6a5ad21 | 243 | $(RM) *.texi *.texi+ *.texi++ git.info gitman.info |
530e741c JH |
244 | $(RM) howto-index.txt howto/*.html doc.dep |
245 | $(RM) technical/api-*.html technical/api-index.txt | |
4cb08df5 | 246 | $(RM) $(cmds_txt) *.made |
b790abb8 | 247 | |
530e741c | 248 | $(MAN_HTML): %.html : %.txt |
bb230097 | 249 | $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ |
7b8a74f3 | 250 | $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \ |
bb230097 | 251 | $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \ |
7b8a74f3 | 252 | mv $@+ $@ |
b790abb8 | 253 | |
4392da4d | 254 | %.1 %.5 %.7 : %.xml |
bb230097 | 255 | $(QUIET_XMLTO)$(RM) $@ && \ |
5121a6d9 | 256 | xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< |
b790abb8 DG |
257 | |
258 | %.xml : %.txt | |
bb230097 | 259 | $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ |
7b8a74f3 | 260 | $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \ |
bb230097 | 261 | $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \ |
7b8a74f3 | 262 | mv $@+ $@ |
3f971fc4 | 263 | |
d19fbc3c | 264 | user-manual.xml: user-manual.txt user-manual.conf |
26e47f25 | 265 | $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book $< |
d19fbc3c | 266 | |
530e741c JH |
267 | technical/api-index.txt: technical/api-index-skel.txt \ |
268 | technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS)) | |
ee7ec2f9 | 269 | $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh |
530e741c JH |
270 | |
271 | $(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt | |
bb230097 | 272 | $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \ |
530e741c JH |
273 | $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt |
274 | ||
1cffddd6 | 275 | XSLT = docbook.xsl |
0a3985dc | 276 | XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css |
1c95c565 | 277 | |
d19fbc3c | 278 | user-manual.html: user-manual.xml |
bb230097 | 279 | $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $< |
d19fbc3c | 280 | |
50b3555c | 281 | git.info: user-manual.texi |
bb230097 | 282 | $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi |
5cefc33b | 283 | |
50b3555c | 284 | user-manual.texi: user-manual.xml |
bb230097 | 285 | $(QUIET_DB2TEXI)$(RM) $@+ $@ && \ |
c6a5ad21 CJ |
286 | $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \ |
287 | $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \ | |
288 | rm $@++ && \ | |
5cefc33b JH |
289 | mv $@+ $@ |
290 | ||
a325a1a7 | 291 | user-manual.pdf: user-manual.xml |
bb230097 CJ |
292 | $(QUIET_DBLATEX)$(RM) $@+ $@ && \ |
293 | $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \ | |
a325a1a7 MV |
294 | mv $@+ $@ |
295 | ||
5cefc33b | 296 | gitman.texi: $(MAN_XML) cat-texi.perl |
bb230097 | 297 | $(QUIET_DB2TEXI)$(RM) $@+ $@ && \ |
8b30ad01 | 298 | ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \ |
c6a5ad21 CJ |
299 | --to-stdout $(xml) &&) true) > $@++ && \ |
300 | $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \ | |
301 | rm $@++ && \ | |
5cefc33b JH |
302 | mv $@+ $@ |
303 | ||
304 | gitman.info: gitman.texi | |
bb230097 | 305 | $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi |
5cefc33b JH |
306 | |
307 | $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml | |
bb230097 CJ |
308 | $(QUIET_DB2TEXI)$(RM) $@+ $@ && \ |
309 | $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \ | |
5cefc33b | 310 | mv $@+ $@ |
4739809c | 311 | |
e6fc2346 | 312 | howto-index.txt: howto-index.sh $(wildcard howto/*.txt) |
bb230097 | 313 | $(QUIET_GEN)$(RM) $@+ $@ && \ |
ee7ec2f9 | 314 | '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \ |
e6fc2346 JH |
315 | mv $@+ $@ |
316 | ||
8db9307c | 317 | $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt |
26e47f25 | 318 | $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 $*.txt |
e6fc2346 JH |
319 | |
320 | WEBDOC_DEST = /pub/software/scm/git/docs | |
321 | ||
8d0991d7 | 322 | $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt |
bb230097 | 323 | $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ |
26e47f25 | 324 | sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \ |
8d0991d7 JH |
325 | mv $@+ $@ |
326 | ||
e6fc2346 | 327 | install-webdoc : html |
ee7ec2f9 | 328 | '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST) |
6538d1ef | 329 | |
b1a46b70 MH |
330 | quick-install: quick-install-man |
331 | ||
332 | quick-install-man: | |
ee7ec2f9 | 333 | '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir) |
7b8a74f3 | 334 | |
6fe570de | 335 | quick-install-html: |
ee7ec2f9 | 336 | '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir) |
6fe570de | 337 | |
7b8a74f3 | 338 | .PHONY: .FORCE-GIT-VERSION-FILE |