blob: bd498d496952a6f78973b0e6b8422552009770d0 [file] [log] [blame]
Ingo Molnarc1c23652009-05-30 12:38:51 +02001MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard perf-*.txt)) \
4 perf.txt
5MAN5_TXT=
6MAN7_TXT=
7
8MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
9MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
10MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
11
12DOC_HTML=$(MAN_HTML)
13
14ARTICLES =
15# with their own formatting rules.
16SP_ARTICLES =
17API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
18SP_ARTICLES += $(API_DOCS)
19SP_ARTICLES += technical/api-index
20
21DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
22
23DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
24DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
25DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
26
John Kacur7ae5f2132010-03-11 13:57:00 +010027# Make the path relative to DESTDIR, not prefix
28ifndef DESTDIR
Ingo Molnarc1c23652009-05-30 12:38:51 +020029prefix?=$(HOME)
John Kacur7ae5f2132010-03-11 13:57:00 +010030endif
Ingo Molnarc1c23652009-05-30 12:38:51 +020031bindir?=$(prefix)/bin
32htmldir?=$(prefix)/share/doc/perf-doc
33pdfdir?=$(prefix)/share/doc/perf-doc
34mandir?=$(prefix)/share/man
35man1dir=$(mandir)/man1
36man5dir=$(mandir)/man5
37man7dir=$(mandir)/man7
Ingo Molnarc1c23652009-05-30 12:38:51 +020038
39ASCIIDOC=asciidoc
Kyle McMartinb395cd82009-08-18 12:41:25 -040040ASCIIDOC_EXTRA = --unsafe
Ingo Molnarc1c23652009-05-30 12:38:51 +020041MANPAGE_XSL = manpage-normal.xsl
42XMLTO_EXTRA =
43INSTALL?=install
44RM ?= rm -f
45DOC_REF = origin/man
46HTML_REF = origin/html
47
48infodir?=$(prefix)/share/info
49MAKEINFO=makeinfo
50INSTALL_INFO=install-info
51DOCBOOK2X_TEXI=docbook2x-texi
52DBLATEX=dblatex
53ifndef PERL_PATH
54 PERL_PATH = /usr/bin/perl
55endif
56
57-include ../config.mak.autogen
58-include ../config.mak
59
60#
61# For asciidoc ...
62# -7.1.2, no extra settings are needed.
63# 8.0-, set ASCIIDOC8.
64#
65
66#
67# For docbook-xsl ...
68# -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
69# 1.69.0, no extra settings are needed?
70# 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
71# 1.71.1, no extra settings are needed?
72# 1.72.0, set DOCBOOK_XSL_172.
73# 1.73.0-, set ASCIIDOC_NO_ROFF
74#
75
76#
77# If you had been using DOCBOOK_XSL_172 in an attempt to get rid
78# of 'the ".ft C" problem' in your generated manpages, and you
79# instead ended up with weird characters around callouts, try
80# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
81#
82
83ifdef ASCIIDOC8
84ASCIIDOC_EXTRA += -a asciidoc7compatible
85endif
86ifdef DOCBOOK_XSL_172
87ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff
88MANPAGE_XSL = manpage-1.72.xsl
89else
90 ifdef ASCIIDOC_NO_ROFF
91 # docbook-xsl after 1.72 needs the regular XSL, but will not
92 # pass-thru raw roff codes from asciidoc.conf, so turn them off.
93 ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff
94 endif
95endif
96ifdef MAN_BOLD_LITERAL
97XMLTO_EXTRA += -m manpage-bold-literal.xsl
98endif
99ifdef DOCBOOK_SUPPRESS_SP
100XMLTO_EXTRA += -m manpage-suppress-sp.xsl
101endif
102
103SHELL_PATH ?= $(SHELL)
104# Shell quote;
105SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
106
107#
108# Please note that there is a minor bug in asciidoc.
109# The version after 6.0.3 _will_ include the patch found here:
110# http://marc.theaimsgroup.com/?l=perf&m=111558757202243&w=2
111#
112# Until that version is released you may have to apply the patch
113# yourself - yes, all 6 characters of it!
114#
115
116QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
117QUIET_SUBDIR1 =
118
119ifneq ($(findstring $(MAKEFLAGS),w),w)
120PRINT_DIR = --no-print-directory
121else # "make -w"
122NO_SUBDIR = :
123endif
124
125ifneq ($(findstring $(MAKEFLAGS),s),s)
126ifndef V
127 QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
128 QUIET_XMLTO = @echo ' ' XMLTO $@;
129 QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
130 QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
131 QUIET_DBLATEX = @echo ' ' DBLATEX $@;
132 QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
133 QUIET_GEN = @echo ' ' GEN $@;
134 QUIET_STDERR = 2> /dev/null
135 QUIET_SUBDIR0 = +@subdir=
136 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
137 $(MAKE) $(PRINT_DIR) -C $$subdir
138 export V
139endif
140endif
141
142all: html man
143
144html: $(DOC_HTML)
145
146$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
147
148man: man1 man5 man7
149man1: $(DOC_MAN1)
150man5: $(DOC_MAN5)
151man7: $(DOC_MAN7)
152
153info: perf.info perfman.info
154
155pdf: user-manual.pdf
156
157install: install-man
158
159install-man: man
160 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
161# $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
162# $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
163 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
164# $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
165# $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
166
167install-info: info
168 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
169 $(INSTALL) -m 644 perf.info perfman.info $(DESTDIR)$(infodir)
170 if test -r $(DESTDIR)$(infodir)/dir; then \
171 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perf.info ;\
172 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perfman.info ;\
173 else \
174 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
175 fi
176
177install-pdf: pdf
178 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
179 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
180
181install-html: html
182 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
183
184../PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
185 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) PERF-VERSION-FILE
186
187-include ../PERF-VERSION-FILE
188
189#
190# Determine "include::" file references in asciidoc files.
191#
192doc.dep : $(wildcard *.txt) build-docdep.perl
193 $(QUIET_GEN)$(RM) $@+ $@ && \
194 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
195 mv $@+ $@
196
197-include doc.dep
198
199cmds_txt = cmds-ancillaryinterrogators.txt \
200 cmds-ancillarymanipulators.txt \
201 cmds-mainporcelain.txt \
202 cmds-plumbinginterrogators.txt \
203 cmds-plumbingmanipulators.txt \
204 cmds-synchingrepositories.txt \
205 cmds-synchelpers.txt \
206 cmds-purehelpers.txt \
207 cmds-foreignscminterface.txt
208
209$(cmds_txt): cmd-list.made
210
211cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
212 $(QUIET_GEN)$(RM) $@ && \
213 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
214 date >$@
215
216clean:
217 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
218 $(RM) *.texi *.texi+ *.texi++ perf.info perfman.info
219 $(RM) howto-index.txt howto/*.html doc.dep
220 $(RM) technical/api-*.html technical/api-index.txt
221 $(RM) $(cmds_txt) *.made
222
223$(MAN_HTML): %.html : %.txt
224 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
225 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
226 $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
227 mv $@+ $@
228
229%.1 %.5 %.7 : %.xml
230 $(QUIET_XMLTO)$(RM) $@ && \
231 xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
232
233%.xml : %.txt
234 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
235 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
236 $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
237 mv $@+ $@
238
239XSLT = docbook.xsl
240XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
241
242user-manual.html: user-manual.xml
243 $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
244
245perf.info: user-manual.texi
246 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
247
248user-manual.texi: user-manual.xml
249 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
250 $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
251 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
252 rm $@++ && \
253 mv $@+ $@
254
255user-manual.pdf: user-manual.xml
256 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
257 $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
258 mv $@+ $@
259
260perfman.texi: $(MAN_XML) cat-texi.perl
261 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
262 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
263 --to-stdout $(xml) &&) true) > $@++ && \
264 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
265 rm $@++ && \
266 mv $@+ $@
267
268perfman.info: perfman.texi
269 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
270
271$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
272 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
273 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
274 mv $@+ $@
275
276howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
277 $(QUIET_GEN)$(RM) $@+ $@ && \
278 '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
279 mv $@+ $@
280
281$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
282 $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 $*.txt
283
284WEBDOC_DEST = /pub/software/tools/perf/docs
285
286$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
287 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
288 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \
289 mv $@+ $@
290
291install-webdoc : html
292 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
293
294quick-install: quick-install-man
295
296quick-install-man:
297 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
298
299quick-install-html:
300 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
301
302.PHONY: .FORCE-PERF-VERSION-FILE