1 include ../../scripts/Makefile.include
2 include ../../scripts/utilities.mak
5 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
6 $(wildcard perf-*.txt)) \
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))
15 MAN_XML=$(addprefix $(OUTPUT),$(_MAN_XML))
16 MAN_HTML=$(addprefix $(OUTPUT),$(_MAN_HTML))
19 # with their own formatting rules.
21 API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
22 SP_ARTICLES += $(API_DOCS)
23 SP_ARTICLES += technical/api-index
25 _DOC_HTML = $(_MAN_HTML)
26 _DOC_HTML+=$(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
27 DOC_HTML=$(addprefix $(OUTPUT),$(_DOC_HTML))
29 _DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
30 _DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
31 _DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
33 DOC_MAN1=$(addprefix $(OUTPUT),$(_DOC_MAN1))
34 DOC_MAN5=$(addprefix $(OUTPUT),$(_DOC_MAN5))
35 DOC_MAN7=$(addprefix $(OUTPUT),$(_DOC_MAN7))
37 # Make the path relative to DESTDIR, not prefix
42 htmldir?=$(prefix)/share/doc/perf-doc
43 pdfdir?=$(prefix)/share/doc/perf-doc
44 mandir?=$(prefix)/share/man
45 man1dir=$(mandir)/man1
46 man5dir=$(mandir)/man5
47 man7dir=$(mandir)/man7
50 ASCIIDOC_EXTRA = --unsafe -f asciidoc.conf
51 ASCIIDOC_HTML = xhtml11
52 MANPAGE_XSL = manpage-normal.xsl
57 HTML_REF = origin/html
60 ASCIIDOC = asciidoctor
61 ASCIIDOC_EXTRA = -a compat-mode
62 ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
63 ASCIIDOC_EXTRA += -a mansource="perf" -a manmanual="perf Manual"
64 ASCIIDOC_HTML = xhtml5
67 infodir?=$(prefix)/share/info
69 INSTALL_INFO=install-info
70 DOCBOOK2X_TEXI=docbook2x-texi
74 PERL_PATH = /usr/bin/perl
77 -include ../config.mak.autogen
78 -include ../config.mak
80 _tmp_tool_path := $(call get-executable,$(ASCIIDOC))
81 ifeq ($(_tmp_tool_path),)
82 missing_tools = $(ASCIIDOC)
85 ifndef USE_ASCIIDOCTOR
86 _tmp_tool_path := $(call get-executable,$(XMLTO))
87 ifeq ($(_tmp_tool_path),)
88 missing_tools += $(XMLTO)
94 # -7.1.2, no extra settings are needed.
95 # 8.0-, set ASCIIDOC8.
100 # -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
101 # 1.69.0, no extra settings are needed?
102 # 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
103 # 1.71.1, no extra settings are needed?
104 # 1.72.0, set DOCBOOK_XSL_172.
105 # 1.73.0-, set ASCIIDOC_NO_ROFF
109 # If you had been using DOCBOOK_XSL_172 in an attempt to get rid
110 # of 'the ".ft C" problem' in your generated manpages, and you
111 # instead ended up with weird characters around callouts, try
112 # using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
116 ASCIIDOC_EXTRA += -a asciidoc7compatible
118 ifdef DOCBOOK_XSL_172
119 ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff
120 MANPAGE_XSL = manpage-1.72.xsl
122 ifdef ASCIIDOC_NO_ROFF
123 # docbook-xsl after 1.72 needs the regular XSL, but will not
124 # pass-thru raw roff codes from asciidoc.conf, so turn them off.
125 ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff
128 ifdef MAN_BOLD_LITERAL
129 XMLTO_EXTRA += -m manpage-bold-literal.xsl
131 ifdef DOCBOOK_SUPPRESS_SP
132 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
135 SHELL_PATH ?= $(SHELL)
137 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
140 # Please note that there is a minor bug in asciidoc.
141 # The version after 6.0.3 _will_ include the patch found here:
142 # http://marc.theaimsgroup.com/?l=perf&m=111558757202243&w=2
144 # Until that version is released you may have to apply the patch
145 # yourself - yes, all 6 characters of it!
148 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
151 ifneq ($(findstring $(MAKEFLAGS),w),w)
152 PRINT_DIR = --no-print-directory
157 ifneq ($(findstring $(MAKEFLAGS),s),s)
159 QUIET_ASCIIDOC = @echo ' ASCIIDOC '$@;
160 QUIET_XMLTO = @echo ' XMLTO '$@;
161 QUIET_DB2TEXI = @echo ' DB2TEXI '$@;
162 QUIET_MAKEINFO = @echo ' MAKEINFO '$@;
163 QUIET_DBLATEX = @echo ' DBLATEX '$@;
164 QUIET_XSLTPROC = @echo ' XSLTPROC '$@;
165 QUIET_GEN = @echo ' GEN '$@;
166 QUIET_STDERR = 2> /dev/null
167 QUIET_SUBDIR0 = +@subdir=
168 QUIET_SUBDIR1 = ;$(NO_SUBDIR) \
169 echo ' SUBDIR ' $$subdir; \
170 $(MAKE) $(PRINT_DIR) -C $$subdir
179 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
186 info: $(OUTPUT)perf.info $(OUTPUT)perfman.info
188 pdf: $(OUTPUT)user-manual.pdf
194 $(error "You need to install $(missing_tools) for man pages")
198 $(call QUIET_INSTALL, Documentation-man) \
199 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir); \
200 # $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir); \
201 # $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir); \
202 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir); \
203 # $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir); \
204 # $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
206 install-man: check-man-tools man do-install-man
209 DO_INSTALL_MAN = $(warning Please install $(missing_tools) to have the man pages installed)
211 DO_INSTALL_MAN = do-install-man
214 try-install-man: $(DO_INSTALL_MAN)
217 $(call QUIET_INSTALL, Documentation-info) \
218 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir); \
219 $(INSTALL) -m 644 $(OUTPUT)perf.info $(OUTPUT)perfman.info $(DESTDIR)$(infodir); \
220 if test -r $(DESTDIR)$(infodir)/dir; then \
221 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perf.info ;\
222 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perfman.info ;\
224 echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
228 $(call QUIET_INSTALL, Documentation-pdf) \
229 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir); \
230 $(INSTALL) -m 644 $(OUTPUT)user-manual.pdf $(DESTDIR)$(pdfdir)
233 # '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
237 # Determine "include::" file references in asciidoc files.
239 $(OUTPUT)doc.dep : $(wildcard *.txt) build-docdep.perl
240 $(QUIET_GEN)$(RM) $@+ $@ && \
241 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
244 -include $(OUPTUT)doc.dep
246 _cmds_txt = cmds-ancillaryinterrogators.txt \
247 cmds-ancillarymanipulators.txt \
248 cmds-mainporcelain.txt \
249 cmds-plumbinginterrogators.txt \
250 cmds-plumbingmanipulators.txt \
251 cmds-synchingrepositories.txt \
252 cmds-synchelpers.txt \
253 cmds-purehelpers.txt \
254 cmds-foreignscminterface.txt
255 cmds_txt=$(addprefix $(OUTPUT),$(_cmds_txt))
257 $(cmds_txt): $(OUTPUT)cmd-list.made
259 $(OUTPUT)cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
260 $(QUIET_GEN)$(RM) $@ && \
261 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
265 $(MAN_XML) $(addsuffix +,$(MAN_XML)) \
266 $(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \
267 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7) \
268 $(OUTPUT)*.texi $(OUTPUT)*.texi+ $(OUTPUT)*.texi++ \
269 $(OUTPUT)perf.info $(OUTPUT)perfman.info \
270 $(OUTPUT)howto-index.txt $(OUTPUT)howto/*.html $(OUTPUT)doc.dep \
271 $(OUTPUT)technical/api-*.html $(OUTPUT)technical/api-index.txt \
272 $(cmds_txt) $(OUTPUT)*.made
274 $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES)
276 $(MAN_HTML): $(OUTPUT)%.html : %.txt
277 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
278 $(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \
279 $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
282 ifdef USE_ASCIIDOCTOR
283 $(OUTPUT)%.1 $(OUTPUT)%.5 $(OUTPUT)%.7 : %.txt
284 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
285 $(ASCIIDOC) -b manpage -d manpage \
286 $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
290 $(OUTPUT)%.1 $(OUTPUT)%.5 $(OUTPUT)%.7 : $(OUTPUT)%.xml
291 $(QUIET_XMLTO)$(RM) $@ && \
292 $(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
294 $(OUTPUT)%.xml : %.txt
295 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
296 $(ASCIIDOC) -b docbook -d manpage \
297 $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
301 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
303 $(OUTPUT)user-manual.html: $(OUTPUT)user-manual.xml
304 $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
306 $(OUTPUT)perf.info: $(OUTPUT)user-manual.texi
307 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ $(OUTPUT)user-manual.texi
309 $(OUTPUT)user-manual.texi: $(OUTPUT)user-manual.xml
310 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
311 $(DOCBOOK2X_TEXI) $(OUTPUT)user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
312 $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
316 $(OUTPUT)user-manual.pdf: $(OUTPUT)user-manual.xml
317 $(QUIET_DBLATEX)$(RM) $@+ $@ && \
318 $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
321 $(OUTPUT)perfman.texi: $(MAN_XML) cat-texi.perl
322 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
323 ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
324 --to-stdout $(xml) &&) true) > $@++ && \
325 $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
329 $(OUTPUT)perfman.info: $(OUTPUT)perfman.texi
330 $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
332 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
333 $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
334 $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
337 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
338 $(QUIET_GEN)$(RM) $@+ $@ && \
339 '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
342 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
343 $(QUIET_ASCIIDOC)$(ASCIIDOC) -b $(ASCIIDOC_HTML) $*.txt
345 WEBDOC_DEST = /pub/software/tools/perf/docs
347 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
348 $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
349 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b $(ASCIIDOC_HTML) - >$@+ && \
353 #install-webdoc : html
354 # '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
356 # quick-install: quick-install-man
359 # '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
362 # '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)