Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / tools / perf / Documentation / Makefile
blob4626a398836a244a48c73b9e03d69fba8dc3ecd6
1 MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard perf-*.txt)) \
4 perf.txt
5 MAN5_TXT=
6 MAN7_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 =
15 # with their own formatting rules.
16 SP_ARTICLES =
17 API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
18 SP_ARTICLES += $(API_DOCS)
19 SP_ARTICLES += technical/api-index
21 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
23 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
24 DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
25 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
27 # Make the path relative to DESTDIR, not prefix
28 ifndef DESTDIR
29 prefix?=$(HOME)
30 endif
31 bindir?=$(prefix)/bin
32 htmldir?=$(prefix)/share/doc/perf-doc
33 pdfdir?=$(prefix)/share/doc/perf-doc
34 mandir?=$(prefix)/share/man
35 man1dir=$(mandir)/man1
36 man5dir=$(mandir)/man5
37 man7dir=$(mandir)/man7
39 ASCIIDOC=asciidoc
40 ASCIIDOC_EXTRA = --unsafe
41 MANPAGE_XSL = manpage-normal.xsl
42 XMLTO_EXTRA =
43 INSTALL?=install
44 RM ?= rm -f
45 DOC_REF = origin/man
46 HTML_REF = origin/html
48 infodir?=$(prefix)/share/info
49 MAKEINFO=makeinfo
50 INSTALL_INFO=install-info
51 DOCBOOK2X_TEXI=docbook2x-texi
52 DBLATEX=dblatex
53 ifndef PERL_PATH
54 PERL_PATH = /usr/bin/perl
55 endif
57 -include ../config.mak.autogen
58 -include ../config.mak
61 # For asciidoc ...
62 # -7.1.2, no extra settings are needed.
63 # 8.0-, set ASCIIDOC8.
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
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).
83 ifdef ASCIIDOC8
84 ASCIIDOC_EXTRA += -a asciidoc7compatible
85 endif
86 ifdef DOCBOOK_XSL_172
87 ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff
88 MANPAGE_XSL = manpage-1.72.xsl
89 else
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
95 endif
96 ifdef MAN_BOLD_LITERAL
97 XMLTO_EXTRA += -m manpage-bold-literal.xsl
98 endif
99 ifdef DOCBOOK_SUPPRESS_SP
100 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
101 endif
103 SHELL_PATH ?= $(SHELL)
104 # Shell quote;
105 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
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
112 # Until that version is released you may have to apply the patch
113 # yourself - yes, all 6 characters of it!
116 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
117 QUIET_SUBDIR1 =
119 ifneq ($(findstring $(MAKEFLAGS),w),w)
120 PRINT_DIR = --no-print-directory
121 else # "make -w"
122 NO_SUBDIR = :
123 endif
125 ifneq ($(findstring $(MAKEFLAGS),s),s)
126 ifndef 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
139 endif
140 endif
142 all: html man
144 html: $(DOC_HTML)
146 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
148 man: man1 man5 man7
149 man1: $(DOC_MAN1)
150 man5: $(DOC_MAN5)
151 man7: $(DOC_MAN7)
153 info: perf.info perfman.info
155 pdf: user-manual.pdf
157 install: install-man
159 install-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)
167 install-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 ; \
177 install-pdf: pdf
178 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
179 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
181 #install-html: html
182 # '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
184 ../PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
185 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) PERF-VERSION-FILE
187 -include ../PERF-VERSION-FILE
190 # Determine "include::" file references in asciidoc files.
192 doc.dep : $(wildcard *.txt) build-docdep.perl
193 $(QUIET_GEN)$(RM) $@+ $@ && \
194 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
195 mv $@+ $@
197 -include doc.dep
199 cmds_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
209 $(cmds_txt): cmd-list.made
211 cmd-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 >$@
216 clean:
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
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 $@+ $@
229 %.1 %.5 %.7 : %.xml
230 $(QUIET_XMLTO)$(RM) $@ && \
231 xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
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 $@+ $@
239 XSLT = docbook.xsl
240 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
242 user-manual.html: user-manual.xml
243 $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
245 perf.info: user-manual.texi
246 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
248 user-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 $@+ $@
255 user-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 $@+ $@
260 perfman.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 $@+ $@
268 perfman.info: perfman.texi
269 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
271 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
272 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
273 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
274 mv $@+ $@
276 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
277 $(QUIET_GEN)$(RM) $@+ $@ && \
278 '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
279 mv $@+ $@
281 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
282 $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 $*.txt
284 WEBDOC_DEST = /pub/software/tools/perf/docs
286 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
287 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
288 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \
289 mv $@+ $@
291 # UNIMPLEMENTED
292 #install-webdoc : html
293 # '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
295 # quick-install: quick-install-man
297 # quick-install-man:
298 # '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
300 #quick-install-html:
301 # '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
303 .PHONY: .FORCE-PERF-VERSION-FILE