1 # SPDX-License-Identifier: GPL-2.0-only
2 include ..
/..
/scripts
/Makefile.
include
3 include ..
/..
/scripts
/utilities.mak
6 $(filter-out $(addsuffix .txt
, $(ARTICLES
) $(SP_ARTICLES
)), \
7 $(wildcard perf-
*.txt
)) \
12 MAN_TXT
= $(MAN1_TXT
) $(MAN5_TXT
) $(MAN7_TXT
)
13 _MAN_XML
=$(patsubst %.txt
,%.xml
,$(MAN_TXT
))
14 _MAN_HTML
=$(patsubst %.txt
,%.html
,$(MAN_TXT
))
16 MAN_XML
=$(addprefix $(OUTPUT
),$(_MAN_XML
))
17 MAN_HTML
=$(addprefix $(OUTPUT
),$(_MAN_HTML
))
20 # with their own formatting rules.
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
26 _DOC_HTML
= $(_MAN_HTML
)
27 _DOC_HTML
+=$(patsubst %,%.html
,$(ARTICLES
) $(SP_ARTICLES
))
28 DOC_HTML
=$(addprefix $(OUTPUT
),$(_DOC_HTML
))
30 _DOC_MAN1
=$(patsubst %.txt
,%.1,$(MAN1_TXT
))
31 _DOC_MAN5
=$(patsubst %.txt
,%.5,$(MAN5_TXT
))
32 _DOC_MAN7
=$(patsubst %.txt
,%.7,$(MAN7_TXT
))
34 DOC_MAN1
=$(addprefix $(OUTPUT
),$(_DOC_MAN1
))
35 DOC_MAN5
=$(addprefix $(OUTPUT
),$(_DOC_MAN5
))
36 DOC_MAN7
=$(addprefix $(OUTPUT
),$(_DOC_MAN7
))
38 # Make the path relative to DESTDIR, not prefix
43 htmldir?
=$(prefix)/share
/doc
/perf-doc
44 pdfdir?
=$(prefix)/share
/doc
/perf-doc
45 mandir?
=$(prefix)/share
/man
46 man1dir=$(mandir)/man1
47 man5dir=$(mandir)/man5
48 man7dir=$(mandir)/man7
51 ASCIIDOC_EXTRA
+= --unsafe
-f asciidoc.conf
52 ASCIIDOC_HTML
= xhtml11
53 MANPAGE_XSL
= manpage-normal.xsl
58 HTML_REF
= origin/html
61 ASCIIDOC
= asciidoctor
62 ASCIIDOC_EXTRA
+= -a compat-mode
63 ASCIIDOC_EXTRA
+= -I.
-rasciidoctor-extensions
64 ASCIIDOC_EXTRA
+= -a mansource
="perf" -a manmanual
="perf Manual"
65 ASCIIDOC_HTML
= xhtml5
68 infodir?
=$(prefix)/share
/info
70 INSTALL_INFO
=install-info
71 DOCBOOK2X_TEXI
=docbook2x-texi
75 PERL_PATH
= /usr
/bin
/perl
78 -include ..
/config.mak.autogen
79 -include ..
/config.mak
81 _tmp_tool_path
:= $(call get-executable
,$(ASCIIDOC
))
82 ifeq ($(_tmp_tool_path
),)
83 missing_tools
= $(ASCIIDOC
)
86 ifndef USE_ASCIIDOCTOR
87 _tmp_tool_path
:= $(call get-executable
,$(XMLTO
))
88 ifeq ($(_tmp_tool_path
),)
89 missing_tools
+= $(XMLTO
)
95 # -7.1.2, no extra settings are needed.
96 # 8.0-, set ASCIIDOC8.
100 # For docbook-xsl ...
101 # -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
102 # 1.69.0, no extra settings are needed?
103 # 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
104 # 1.71.1, no extra settings are needed?
105 # 1.72.0, set DOCBOOK_XSL_172.
106 # 1.73.0-, set ASCIIDOC_NO_ROFF
110 # If you had been using DOCBOOK_XSL_172 in an attempt to get rid
111 # of 'the ".ft C" problem' in your generated manpages, and you
112 # instead ended up with weird characters around callouts, try
113 # using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
117 ASCIIDOC_EXTRA
+= -a asciidoc7compatible
119 ifdef DOCBOOK_XSL_172
120 ASCIIDOC_EXTRA
+= -a perf-asciidoc-no-roff
121 MANPAGE_XSL
= manpage-1.72.xsl
123 ifdef ASCIIDOC_NO_ROFF
124 # docbook-xsl after 1.72 needs the regular XSL, but will not
125 # pass-thru raw roff codes from asciidoc.conf, so turn them off.
126 ASCIIDOC_EXTRA
+= -a perf-asciidoc-no-roff
129 ifdef MAN_BOLD_LITERAL
130 XMLTO_EXTRA
+= -m manpage-bold-literal.xsl
132 ifdef DOCBOOK_SUPPRESS_SP
133 XMLTO_EXTRA
+= -m manpage-suppress-sp.xsl
136 SHELL_PATH ?
= $(SHELL
)
138 SHELL_PATH_SQ
= $(subst ','\'',$(SHELL_PATH))
141 # Please note that there is a minor bug in asciidoc.
142 # The version after 6.0.3 _will_ include the patch found here:
143 # http://marc.theaimsgroup.com/?l=perf&m=111558757202243&w=2
145 # Until that version is released you may have to apply the patch
146 # yourself - yes, all 6 characters of it!
149 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
152 ifneq ($(findstring $(MAKEFLAGS),w),w)
153 PRINT_DIR = --no-print-directory
158 ifneq ($(findstring $(MAKEFLAGS),s),s)
160 QUIET_ASCIIDOC = @echo ' ASCIIDOC
'$@;
161 QUIET_XMLTO = @echo ' XMLTO
'$@;
162 QUIET_DB2TEXI = @echo ' DB2TEXI
'$@;
163 QUIET_MAKEINFO = @echo ' MAKEINFO
'$@;
164 QUIET_DBLATEX = @echo ' DBLATEX
'$@;
165 QUIET_XSLTPROC = @echo ' XSLTPROC
'$@;
166 QUIET_GEN = @echo ' GEN
'$@;
167 QUIET_STDERR = 2> /dev/null
168 QUIET_SUBDIR0 = +@subdir=
169 QUIET_SUBDIR1 = ;$(NO_SUBDIR) \
170 echo ' SUBDIR
' $$subdir; \
171 $(MAKE) $(PRINT_DIR) -C $$subdir
180 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
187 info: $(OUTPUT)perf.info $(OUTPUT)perfman.info
189 pdf: $(OUTPUT)user-manual.pdf
195 $(error "You need to install $(missing_tools) for man pages")
199 $(call QUIET_INSTALL, Documentation-man) \
200 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir); \
201 # $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir); \
202 # $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir); \
203 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir); \
204 # $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir); \
205 # $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
207 install-man: check-man-tools man do-install-man
210 DO_INSTALL_MAN = $(warning Please install $(missing_tools) to have the man pages installed)
212 DO_INSTALL_MAN = do-install-man
215 try-install-man: $(DO_INSTALL_MAN)
218 $(call QUIET_INSTALL, Documentation-info) \
219 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir); \
220 $(INSTALL) -m 644 $(OUTPUT)perf.info $(OUTPUT)perfman.info $(DESTDIR)$(infodir); \
221 if test -r $(DESTDIR)$(infodir)/dir; then \
222 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perf.info ;\
223 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perfman.info ;\
225 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
229 $(call QUIET_INSTALL, Documentation-pdf) \
230 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir); \
231 $(INSTALL) -m 644 $(OUTPUT)user-manual.pdf $(DESTDIR)$(pdfdir)
234 # '$(SHELL_PATH_SQ
)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
238 # Determine "include::" file references in asciidoc files.
240 $(OUTPUT)doc.dep : $(wildcard *.txt) build-docdep.perl
241 $(QUIET_GEN)$(RM) $@+ $@ && \
242 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
245 -include $(OUTPUT)doc.dep
247 _cmds_txt = cmds-ancillaryinterrogators.txt \
248 cmds-ancillarymanipulators.txt \
249 cmds-mainporcelain.txt \
250 cmds-plumbinginterrogators.txt \
251 cmds-plumbingmanipulators.txt \
252 cmds-synchingrepositories.txt \
253 cmds-synchelpers.txt \
254 cmds-purehelpers.txt \
255 cmds-foreignscminterface.txt
256 cmds_txt=$(addprefix $(OUTPUT),$(_cmds_txt))
258 $(cmds_txt): $(OUTPUT)cmd-list.made
260 $(OUTPUT)cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
261 $(QUIET_GEN)$(RM) $@ && \
262 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
266 $(MAN_XML) $(addsuffix +,$(MAN_XML)) \
267 $(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \
268 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7) \
269 $(OUTPUT)*.texi $(OUTPUT)*.texi+ $(OUTPUT)*.texi++ \
270 $(OUTPUT)perf.info $(OUTPUT)perfman.info \
271 $(OUTPUT)howto-index.txt $(OUTPUT)howto/*.html $(OUTPUT)doc.dep \
272 $(OUTPUT)technical/api-*.html $(OUTPUT)technical/api-index.txt \
273 $(cmds_txt) $(OUTPUT)*.made
275 $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES)
277 $(MAN_HTML): $(OUTPUT)%.html : %.txt
278 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
279 $(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \
280 $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
283 ifdef USE_ASCIIDOCTOR
284 $(OUTPUT)%.1 $(OUTPUT)%.5 $(OUTPUT)%.7 : %.txt
285 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
286 $(ASCIIDOC) -b manpage -d manpage \
287 $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
291 $(OUTPUT)%.1 $(OUTPUT)%.5 $(OUTPUT)%.7 : $(OUTPUT)%.xml
292 $(QUIET_XMLTO)$(RM) $@ && \
293 $(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
295 $(OUTPUT)%.xml : %.txt
296 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
297 $(ASCIIDOC) -b docbook -d manpage \
298 $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) \
299 -aperf_date=$(shell git log -1 --pretty="format:%cd" \
305 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
307 $(OUTPUT)user-manual.html: $(OUTPUT)user-manual.xml
308 $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
310 $(OUTPUT)perf.info: $(OUTPUT)user-manual.texi
311 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ $(OUTPUT)user-manual.texi
313 $(OUTPUT)user-manual.texi: $(OUTPUT)user-manual.xml
314 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
315 $(DOCBOOK2X_TEXI) $(OUTPUT)user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
316 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
320 $(OUTPUT)user-manual.pdf: $(OUTPUT)user-manual.xml
321 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
322 $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
325 $(OUTPUT)perfman.texi: $(MAN_XML) cat-texi.perl
326 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
327 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
328 --to-stdout $(xml) &&) true) > $@++ && \
329 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
333 $(OUTPUT)perfman.info: $(OUTPUT)perfman.texi
334 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
336 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
337 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
338 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
341 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
342 $(QUIET_GEN)$(RM) $@+ $@ && \
343 '$(SHELL_PATH_SQ
)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
346 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
347 $(QUIET_ASCIIDOC)$(ASCIIDOC) -b $(ASCIIDOC_HTML) $*.txt
349 WEBDOC_DEST = /pub/software/tools/perf/docs
351 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
352 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
353 sed -e '1,/^
$$/d
' $< | $(ASCIIDOC) -b $(ASCIIDOC_HTML) - >$@+ && \
357 #install-webdoc : html
358 # '$(SHELL_PATH_SQ
)' ./install-webdoc.sh $(WEBDOC_DEST)
360 # quick-install: quick-install-man
363 # '$(SHELL_PATH_SQ
)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
366 # '$(SHELL_PATH_SQ
)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)