181de3bf3SJiri Olsa# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) 281de3bf3SJiri Olsa# Most of this file is copied from tools/perf/Documentation/Makefile 381de3bf3SJiri Olsa 481de3bf3SJiri Olsainclude ../../../scripts/Makefile.include 581de3bf3SJiri Olsainclude ../../../scripts/utilities.mak 681de3bf3SJiri Olsa 781de3bf3SJiri OlsaMAN3_TXT = libperf.txt 881de3bf3SJiri OlsaMAN7_TXT = libperf-counting.txt libperf-sampling.txt 981de3bf3SJiri OlsaMAN_EX = examples/*.c 1081de3bf3SJiri Olsa 1181de3bf3SJiri OlsaMAN_TXT = $(MAN3_TXT) $(MAN7_TXT) 1281de3bf3SJiri Olsa 1381de3bf3SJiri Olsa_MAN_XML = $(patsubst %.txt,%.xml,$(MAN_TXT)) 1481de3bf3SJiri Olsa_MAN_HTML = $(patsubst %.txt,%.html,$(MAN_TXT)) 1581de3bf3SJiri Olsa_MAN_3 = $(patsubst %.txt,%.3,$(MAN3_TXT)) 1681de3bf3SJiri Olsa_MAN_7 = $(patsubst %.txt,%.7,$(MAN7_TXT)) 1781de3bf3SJiri Olsa 1881de3bf3SJiri OlsaMAN_XML = $(addprefix $(OUTPUT),$(_MAN_XML)) 1981de3bf3SJiri OlsaMAN_HTML = $(addprefix $(OUTPUT),$(_MAN_HTML)) 2081de3bf3SJiri OlsaMAN_3 = $(addprefix $(OUTPUT),$(_MAN_3)) 2181de3bf3SJiri OlsaMAN_7 = $(addprefix $(OUTPUT),$(_MAN_7)) 2281de3bf3SJiri OlsaMAN_X = $(MAN_3) $(MAN_7) 2381de3bf3SJiri Olsa 2481de3bf3SJiri Olsa# Make the path relative to DESTDIR, not prefix 2581de3bf3SJiri Olsaifndef DESTDIR 2681de3bf3SJiri Olsa prefix ?=$(HOME) 2781de3bf3SJiri Olsaendif 2881de3bf3SJiri Olsa 2981de3bf3SJiri Olsamandir ?= $(prefix)/share/man 3081de3bf3SJiri Olsaman3dir = $(mandir)/man3 3181de3bf3SJiri Olsaman7dir = $(mandir)/man7 3281de3bf3SJiri Olsa 3381de3bf3SJiri Olsadocdir ?= $(prefix)/share/doc/libperf 3481de3bf3SJiri Olsahtmldir = $(docdir)/html 3581de3bf3SJiri Olsaexdir = $(docdir)/examples 3681de3bf3SJiri Olsa 3781de3bf3SJiri OlsaASCIIDOC = asciidoc 3881de3bf3SJiri OlsaASCIIDOC_EXTRA = --unsafe -f asciidoc.conf 3981de3bf3SJiri OlsaASCIIDOC_HTML = xhtml11 4081de3bf3SJiri OlsaMANPAGE_XSL = manpage-normal.xsl 4181de3bf3SJiri OlsaXMLTO_EXTRA = 4281de3bf3SJiri OlsaXMLTO =xmlto 4381de3bf3SJiri Olsa 4481de3bf3SJiri OlsaINSTALL ?= install 4581de3bf3SJiri OlsaRM ?= rm -f 4681de3bf3SJiri Olsa 4781de3bf3SJiri Olsa# For asciidoc ... 4881de3bf3SJiri Olsa# -7.1.2, no extra settings are needed. 4981de3bf3SJiri Olsa# 8.0-, set ASCIIDOC8. 5081de3bf3SJiri Olsa# 5181de3bf3SJiri Olsa 5281de3bf3SJiri Olsa# For docbook-xsl ... 5381de3bf3SJiri Olsa# -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0) 5481de3bf3SJiri Olsa# 1.69.0, no extra settings are needed? 5581de3bf3SJiri Olsa# 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP? 5681de3bf3SJiri Olsa# 1.71.1, no extra settings are needed? 5781de3bf3SJiri Olsa# 1.72.0, set DOCBOOK_XSL_172. 5881de3bf3SJiri Olsa# 1.73.0-, set ASCIIDOC_NO_ROFF 5981de3bf3SJiri Olsa 6081de3bf3SJiri Olsa# If you had been using DOCBOOK_XSL_172 in an attempt to get rid 6181de3bf3SJiri Olsa# of 'the ".ft C" problem' in your generated manpages, and you 6281de3bf3SJiri Olsa# instead ended up with weird characters around callouts, try 6381de3bf3SJiri Olsa# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8). 6481de3bf3SJiri Olsa 6581de3bf3SJiri Olsaifdef ASCIIDOC8 6681de3bf3SJiri Olsa ASCIIDOC_EXTRA += -a asciidoc7compatible 6781de3bf3SJiri Olsaendif 6881de3bf3SJiri Olsaifdef DOCBOOK_XSL_172 6981de3bf3SJiri Olsa ASCIIDOC_EXTRA += -a libperf-asciidoc-no-roff 7081de3bf3SJiri Olsa MANPAGE_XSL = manpage-1.72.xsl 7181de3bf3SJiri Olsaelse 7281de3bf3SJiri Olsa ifdef ASCIIDOC_NO_ROFF 7381de3bf3SJiri Olsa # docbook-xsl after 1.72 needs the regular XSL, but will not 7481de3bf3SJiri Olsa # pass-thru raw roff codes from asciidoc.conf, so turn them off. 7581de3bf3SJiri Olsa ASCIIDOC_EXTRA += -a libperf-asciidoc-no-roff 7681de3bf3SJiri Olsa endif 7781de3bf3SJiri Olsaendif 7881de3bf3SJiri Olsaifdef MAN_BOLD_LITERAL 7981de3bf3SJiri Olsa XMLTO_EXTRA += -m manpage-bold-literal.xsl 8081de3bf3SJiri Olsaendif 8181de3bf3SJiri Olsaifdef DOCBOOK_SUPPRESS_SP 8281de3bf3SJiri Olsa XMLTO_EXTRA += -m manpage-suppress-sp.xsl 8381de3bf3SJiri Olsaendif 8481de3bf3SJiri Olsa 8581de3bf3SJiri OlsaDESTDIR ?= 8681de3bf3SJiri OlsaDESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' 8781de3bf3SJiri Olsa 8881de3bf3SJiri Olsaexport DESTDIR DESTDIR_SQ 8981de3bf3SJiri Olsa 9081de3bf3SJiri Olsa# Please note that there is a minor bug in asciidoc. 9181de3bf3SJiri Olsa# The version after 6.0.3 _will_ include the patch found here: 9281de3bf3SJiri Olsa# http://marc.theaimsgroup.com/?l=libtraceevent&m=111558757202243&w=2 9381de3bf3SJiri Olsa# 9481de3bf3SJiri Olsa# Until that version is released you may have to apply the patch 9581de3bf3SJiri Olsa# yourself - yes, all 6 characters of it! 9681de3bf3SJiri Olsa 9781de3bf3SJiri OlsaQUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir 9881de3bf3SJiri OlsaQUIET_SUBDIR1 = 9981de3bf3SJiri Olsa 10081de3bf3SJiri Olsaifneq ($(findstring $(MAKEFLAGS),w),w) 10181de3bf3SJiri Olsa PRINT_DIR = --no-print-directory 10281de3bf3SJiri Olsaelse # "make -w" 10381de3bf3SJiri Olsa NO_SUBDIR = : 10481de3bf3SJiri Olsaendif 10581de3bf3SJiri Olsa 10681de3bf3SJiri Olsaifneq ($(findstring $(MAKEFLAGS),s),s) 10781de3bf3SJiri Olsa ifneq ($(V),1) 10881de3bf3SJiri Olsa QUIET_ASCIIDOC = @echo ' ASCIIDOC '$@; 10981de3bf3SJiri Olsa QUIET_XMLTO = @echo ' XMLTO '$@; 11081de3bf3SJiri Olsa endif 11181de3bf3SJiri Olsaendif 11281de3bf3SJiri Olsa 11381de3bf3SJiri Olsaall: $(MAN_X) $(MAN_HTML) 11481de3bf3SJiri Olsa 11581de3bf3SJiri Olsa$(MAN_HTML) $(MAN_X): asciidoc.conf 11681de3bf3SJiri Olsa 11781de3bf3SJiri Olsainstall-man: all 11881de3bf3SJiri Olsa $(call QUIET_INSTALL, man) \ 11981de3bf3SJiri Olsa $(INSTALL) -d -m 755 $(DESTDIR)$(man3dir); \ 12081de3bf3SJiri Olsa $(INSTALL) -m 644 $(MAN_3) $(DESTDIR)$(man3dir); \ 12181de3bf3SJiri Olsa $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir); \ 12281de3bf3SJiri Olsa $(INSTALL) -m 644 $(MAN_7) $(DESTDIR)$(man7dir); 12381de3bf3SJiri Olsa 124*6490dda5SAkihiko Odakiinstall-html: $(MAN_HTML) 12581de3bf3SJiri Olsa $(call QUIET_INSTALL, html) \ 12681de3bf3SJiri Olsa $(INSTALL) -d -m 755 $(DESTDIR)$(htmldir); \ 12781de3bf3SJiri Olsa $(INSTALL) -m 644 $(MAN_HTML) $(DESTDIR)$(htmldir); \ 12881de3bf3SJiri Olsa 12981de3bf3SJiri Olsainstall-examples: 13081de3bf3SJiri Olsa $(call QUIET_INSTALL, examples) \ 13181de3bf3SJiri Olsa $(INSTALL) -d -m 755 $(DESTDIR)$(exdir); \ 13281de3bf3SJiri Olsa $(INSTALL) -m 644 $(MAN_EX) $(DESTDIR)$(exdir); \ 13381de3bf3SJiri Olsa 13481de3bf3SJiri OlsaCLEAN_FILES = \ 13581de3bf3SJiri Olsa $(MAN_XML) $(addsuffix +,$(MAN_XML)) \ 13681de3bf3SJiri Olsa $(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \ 13781de3bf3SJiri Olsa $(MAN_X) 1383ce311afSJiri Olsa 1393ce311afSJiri Olsaclean: 14081de3bf3SJiri Olsa $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES) 14181de3bf3SJiri Olsa 14281de3bf3SJiri Olsa$(MAN_3): $(OUTPUT)%.3: %.xml 14381de3bf3SJiri Olsa $(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< 14481de3bf3SJiri Olsa 14581de3bf3SJiri Olsa$(MAN_7): $(OUTPUT)%.7: %.xml 14681de3bf3SJiri Olsa $(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< 14781de3bf3SJiri Olsa 14881de3bf3SJiri Olsa$(MAN_XML): $(OUTPUT)%.xml: %.txt 14981de3bf3SJiri Olsa $(QUIET_ASCIIDOC)$(ASCIIDOC) -b docbook -d manpage \ 15081de3bf3SJiri Olsa $(ASCIIDOC_EXTRA) -alibperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ 15181de3bf3SJiri Olsa mv $@+ $@ 15281de3bf3SJiri Olsa 15381de3bf3SJiri Olsa$(MAN_HTML): $(OUTPUT)%.html: %.txt 15481de3bf3SJiri Olsa $(QUIET_ASCIIDOC)$(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \ 15581de3bf3SJiri Olsa $(ASCIIDOC_EXTRA) -aperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ 15681de3bf3SJiri Olsa mv $@+ $@ 157