18c2ecf20Sopenharmony_ciinclude ../../../scripts/Makefile.include 28c2ecf20Sopenharmony_ciinclude ../../../scripts/utilities.mak 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci# This Makefile and manpage XSL files were taken from tools/perf/Documentation 58c2ecf20Sopenharmony_ci# and modified for libtraceevent. 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ciMAN3_TXT= \ 88c2ecf20Sopenharmony_ci $(wildcard libtraceevent-*.txt) \ 98c2ecf20Sopenharmony_ci libtraceevent.txt 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ciMAN_TXT = $(MAN3_TXT) 128c2ecf20Sopenharmony_ci_MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT)) 138c2ecf20Sopenharmony_ci_MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT)) 148c2ecf20Sopenharmony_ci_DOC_MAN3=$(patsubst %.txt,%.3,$(MAN3_TXT)) 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciMAN_XML=$(addprefix $(OUTPUT),$(_MAN_XML)) 178c2ecf20Sopenharmony_ciMAN_HTML=$(addprefix $(OUTPUT),$(_MAN_HTML)) 188c2ecf20Sopenharmony_ciDOC_MAN3=$(addprefix $(OUTPUT),$(_DOC_MAN3)) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci# Make the path relative to DESTDIR, not prefix 218c2ecf20Sopenharmony_ciifndef DESTDIR 228c2ecf20Sopenharmony_ciprefix?=$(HOME) 238c2ecf20Sopenharmony_ciendif 248c2ecf20Sopenharmony_cibindir?=$(prefix)/bin 258c2ecf20Sopenharmony_cihtmldir?=$(prefix)/share/doc/libtraceevent-doc 268c2ecf20Sopenharmony_cipdfdir?=$(prefix)/share/doc/libtraceevent-doc 278c2ecf20Sopenharmony_cimandir?=$(prefix)/share/man 288c2ecf20Sopenharmony_ciman3dir=$(mandir)/man3 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ciASCIIDOC=asciidoc 318c2ecf20Sopenharmony_ciASCIIDOC_EXTRA = --unsafe -f asciidoc.conf 328c2ecf20Sopenharmony_ciASCIIDOC_HTML = xhtml11 338c2ecf20Sopenharmony_ciMANPAGE_XSL = manpage-normal.xsl 348c2ecf20Sopenharmony_ciXMLTO_EXTRA = 358c2ecf20Sopenharmony_ciINSTALL?=install 368c2ecf20Sopenharmony_ciRM ?= rm -f 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ciifdef USE_ASCIIDOCTOR 398c2ecf20Sopenharmony_ciASCIIDOC = asciidoctor 408c2ecf20Sopenharmony_ciASCIIDOC_EXTRA = -a compat-mode 418c2ecf20Sopenharmony_ciASCIIDOC_EXTRA += -I. -rasciidoctor-extensions 428c2ecf20Sopenharmony_ciASCIIDOC_EXTRA += -a mansource="libtraceevent" -a manmanual="libtraceevent Manual" 438c2ecf20Sopenharmony_ciASCIIDOC_HTML = xhtml5 448c2ecf20Sopenharmony_ciendif 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ciXMLTO=xmlto 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci_tmp_tool_path := $(call get-executable,$(ASCIIDOC)) 498c2ecf20Sopenharmony_ciifeq ($(_tmp_tool_path),) 508c2ecf20Sopenharmony_ci missing_tools = $(ASCIIDOC) 518c2ecf20Sopenharmony_ciendif 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ciifndef USE_ASCIIDOCTOR 548c2ecf20Sopenharmony_ci_tmp_tool_path := $(call get-executable,$(XMLTO)) 558c2ecf20Sopenharmony_ciifeq ($(_tmp_tool_path),) 568c2ecf20Sopenharmony_ci missing_tools += $(XMLTO) 578c2ecf20Sopenharmony_ciendif 588c2ecf20Sopenharmony_ciendif 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci# 618c2ecf20Sopenharmony_ci# For asciidoc ... 628c2ecf20Sopenharmony_ci# -7.1.2, no extra settings are needed. 638c2ecf20Sopenharmony_ci# 8.0-, set ASCIIDOC8. 648c2ecf20Sopenharmony_ci# 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci# 678c2ecf20Sopenharmony_ci# For docbook-xsl ... 688c2ecf20Sopenharmony_ci# -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0) 698c2ecf20Sopenharmony_ci# 1.69.0, no extra settings are needed? 708c2ecf20Sopenharmony_ci# 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP? 718c2ecf20Sopenharmony_ci# 1.71.1, no extra settings are needed? 728c2ecf20Sopenharmony_ci# 1.72.0, set DOCBOOK_XSL_172. 738c2ecf20Sopenharmony_ci# 1.73.0-, set ASCIIDOC_NO_ROFF 748c2ecf20Sopenharmony_ci# 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci# 778c2ecf20Sopenharmony_ci# If you had been using DOCBOOK_XSL_172 in an attempt to get rid 788c2ecf20Sopenharmony_ci# of 'the ".ft C" problem' in your generated manpages, and you 798c2ecf20Sopenharmony_ci# instead ended up with weird characters around callouts, try 808c2ecf20Sopenharmony_ci# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8). 818c2ecf20Sopenharmony_ci# 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ciifdef ASCIIDOC8 848c2ecf20Sopenharmony_ciASCIIDOC_EXTRA += -a asciidoc7compatible 858c2ecf20Sopenharmony_ciendif 868c2ecf20Sopenharmony_ciifdef DOCBOOK_XSL_172 878c2ecf20Sopenharmony_ciASCIIDOC_EXTRA += -a libtraceevent-asciidoc-no-roff 888c2ecf20Sopenharmony_ciMANPAGE_XSL = manpage-1.72.xsl 898c2ecf20Sopenharmony_cielse 908c2ecf20Sopenharmony_ci ifdef ASCIIDOC_NO_ROFF 918c2ecf20Sopenharmony_ci # docbook-xsl after 1.72 needs the regular XSL, but will not 928c2ecf20Sopenharmony_ci # pass-thru raw roff codes from asciidoc.conf, so turn them off. 938c2ecf20Sopenharmony_ci ASCIIDOC_EXTRA += -a libtraceevent-asciidoc-no-roff 948c2ecf20Sopenharmony_ci endif 958c2ecf20Sopenharmony_ciendif 968c2ecf20Sopenharmony_ciifdef MAN_BOLD_LITERAL 978c2ecf20Sopenharmony_ciXMLTO_EXTRA += -m manpage-bold-literal.xsl 988c2ecf20Sopenharmony_ciendif 998c2ecf20Sopenharmony_ciifdef DOCBOOK_SUPPRESS_SP 1008c2ecf20Sopenharmony_ciXMLTO_EXTRA += -m manpage-suppress-sp.xsl 1018c2ecf20Sopenharmony_ciendif 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ciSHELL_PATH ?= $(SHELL) 1048c2ecf20Sopenharmony_ci# Shell quote; 1058c2ecf20Sopenharmony_ciSHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ciDESTDIR ?= 1088c2ecf20Sopenharmony_ciDESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ciexport DESTDIR DESTDIR_SQ 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci# 1138c2ecf20Sopenharmony_ci# Please note that there is a minor bug in asciidoc. 1148c2ecf20Sopenharmony_ci# The version after 6.0.3 _will_ include the patch found here: 1158c2ecf20Sopenharmony_ci# http://marc.theaimsgroup.com/?l=libtraceevent&m=111558757202243&w=2 1168c2ecf20Sopenharmony_ci# 1178c2ecf20Sopenharmony_ci# Until that version is released you may have to apply the patch 1188c2ecf20Sopenharmony_ci# yourself - yes, all 6 characters of it! 1198c2ecf20Sopenharmony_ci# 1208c2ecf20Sopenharmony_ciQUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir 1218c2ecf20Sopenharmony_ciQUIET_SUBDIR1 = 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ciifneq ($(findstring $(MAKEFLAGS),w),w) 1248c2ecf20Sopenharmony_ciPRINT_DIR = --no-print-directory 1258c2ecf20Sopenharmony_cielse # "make -w" 1268c2ecf20Sopenharmony_ciNO_SUBDIR = : 1278c2ecf20Sopenharmony_ciendif 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ciifneq ($(findstring $(MAKEFLAGS),s),s) 1308c2ecf20Sopenharmony_ciifneq ($(V),1) 1318c2ecf20Sopenharmony_ci QUIET_ASCIIDOC = @echo ' ASCIIDOC '$@; 1328c2ecf20Sopenharmony_ci QUIET_XMLTO = @echo ' XMLTO '$@; 1338c2ecf20Sopenharmony_ci QUIET_SUBDIR0 = +@subdir= 1348c2ecf20Sopenharmony_ci QUIET_SUBDIR1 = ;$(NO_SUBDIR) \ 1358c2ecf20Sopenharmony_ci echo ' SUBDIR ' $$subdir; \ 1368c2ecf20Sopenharmony_ci $(MAKE) $(PRINT_DIR) -C $$subdir 1378c2ecf20Sopenharmony_ci export V 1388c2ecf20Sopenharmony_ciendif 1398c2ecf20Sopenharmony_ciendif 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ciall: html man 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ciman: man3 1448c2ecf20Sopenharmony_ciman3: $(DOC_MAN3) 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_cihtml: $(MAN_HTML) 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci$(MAN_HTML) $(DOC_MAN3): asciidoc.conf 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ciinstall: install-man 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_cicheck-man-tools: 1538c2ecf20Sopenharmony_ciifdef missing_tools 1548c2ecf20Sopenharmony_ci $(error "You need to install $(missing_tools) for man pages") 1558c2ecf20Sopenharmony_ciendif 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_cido-install-man: man 1588c2ecf20Sopenharmony_ci $(call QUIET_INSTALL, Documentation-man) \ 1598c2ecf20Sopenharmony_ci $(INSTALL) -d -m 755 $(DESTDIR)$(man3dir); \ 1608c2ecf20Sopenharmony_ci $(INSTALL) -m 644 $(DOC_MAN3) $(DESTDIR)$(man3dir); 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ciinstall-man: check-man-tools man do-install-man 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ciuninstall: uninstall-man 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ciuninstall-man: 1678c2ecf20Sopenharmony_ci $(call QUIET_UNINST, Documentation-man) \ 1688c2ecf20Sopenharmony_ci $(Q)$(RM) $(addprefix $(DESTDIR)$(man3dir)/,$(DOC_MAN3)) 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ciifdef missing_tools 1728c2ecf20Sopenharmony_ci DO_INSTALL_MAN = $(warning Please install $(missing_tools) to have the man pages installed) 1738c2ecf20Sopenharmony_cielse 1748c2ecf20Sopenharmony_ci DO_INSTALL_MAN = do-install-man 1758c2ecf20Sopenharmony_ciendif 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ciCLEAN_FILES = \ 1788c2ecf20Sopenharmony_ci $(MAN_XML) $(addsuffix +,$(MAN_XML)) \ 1798c2ecf20Sopenharmony_ci $(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \ 1808c2ecf20Sopenharmony_ci $(DOC_MAN3) *.3 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ciclean: 1838c2ecf20Sopenharmony_ci $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES) 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ciifdef USE_ASCIIDOCTOR 1868c2ecf20Sopenharmony_ci$(OUTPUT)%.3 : $(OUTPUT)%.txt 1878c2ecf20Sopenharmony_ci $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ 1888c2ecf20Sopenharmony_ci $(ASCIIDOC) -b manpage -d manpage \ 1898c2ecf20Sopenharmony_ci $(ASCIIDOC_EXTRA) -alibtraceevent_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ 1908c2ecf20Sopenharmony_ci mv $@+ $@ 1918c2ecf20Sopenharmony_ciendif 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci$(OUTPUT)%.3 : $(OUTPUT)%.xml 1948c2ecf20Sopenharmony_ci $(QUIET_XMLTO)$(RM) $@ && \ 1958c2ecf20Sopenharmony_ci $(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci$(OUTPUT)%.xml : %.txt 1988c2ecf20Sopenharmony_ci $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ 1998c2ecf20Sopenharmony_ci $(ASCIIDOC) -b docbook -d manpage \ 2008c2ecf20Sopenharmony_ci $(ASCIIDOC_EXTRA) -alibtraceevent_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ 2018c2ecf20Sopenharmony_ci mv $@+ $@ 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci$(MAN_HTML): $(OUTPUT)%.html : %.txt 2048c2ecf20Sopenharmony_ci $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ 2058c2ecf20Sopenharmony_ci $(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \ 2068c2ecf20Sopenharmony_ci $(ASCIIDOC_EXTRA) -aperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ 2078c2ecf20Sopenharmony_ci mv $@+ $@ 208