1*81de3bf3SJiri Olsa# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) 2*81de3bf3SJiri Olsa# Most of this file is copied from tools/perf/Documentation/Makefile 3*81de3bf3SJiri Olsa 4*81de3bf3SJiri Olsainclude ../../../scripts/Makefile.include 5*81de3bf3SJiri Olsainclude ../../../scripts/utilities.mak 6*81de3bf3SJiri Olsa 7*81de3bf3SJiri OlsaMAN3_TXT = libperf.txt 8*81de3bf3SJiri OlsaMAN7_TXT = libperf-counting.txt libperf-sampling.txt 9*81de3bf3SJiri OlsaMAN_EX = examples/*.c 10*81de3bf3SJiri Olsa 11*81de3bf3SJiri OlsaMAN_TXT = $(MAN3_TXT) $(MAN7_TXT) 12*81de3bf3SJiri Olsa 13*81de3bf3SJiri Olsa_MAN_XML = $(patsubst %.txt,%.xml,$(MAN_TXT)) 14*81de3bf3SJiri Olsa_MAN_HTML = $(patsubst %.txt,%.html,$(MAN_TXT)) 15*81de3bf3SJiri Olsa_MAN_3 = $(patsubst %.txt,%.3,$(MAN3_TXT)) 16*81de3bf3SJiri Olsa_MAN_7 = $(patsubst %.txt,%.7,$(MAN7_TXT)) 17*81de3bf3SJiri Olsa 18*81de3bf3SJiri OlsaMAN_XML = $(addprefix $(OUTPUT),$(_MAN_XML)) 19*81de3bf3SJiri OlsaMAN_HTML = $(addprefix $(OUTPUT),$(_MAN_HTML)) 20*81de3bf3SJiri OlsaMAN_3 = $(addprefix $(OUTPUT),$(_MAN_3)) 21*81de3bf3SJiri OlsaMAN_7 = $(addprefix $(OUTPUT),$(_MAN_7)) 22*81de3bf3SJiri OlsaMAN_X = $(MAN_3) $(MAN_7) 23*81de3bf3SJiri Olsa 24*81de3bf3SJiri Olsa# Make the path relative to DESTDIR, not prefix 25*81de3bf3SJiri Olsaifndef DESTDIR 26*81de3bf3SJiri Olsa prefix ?=$(HOME) 27*81de3bf3SJiri Olsaendif 28*81de3bf3SJiri Olsa 29*81de3bf3SJiri Olsamandir ?= $(prefix)/share/man 30*81de3bf3SJiri Olsaman3dir = $(mandir)/man3 31*81de3bf3SJiri Olsaman7dir = $(mandir)/man7 32*81de3bf3SJiri Olsa 33*81de3bf3SJiri Olsadocdir ?= $(prefix)/share/doc/libperf 34*81de3bf3SJiri Olsahtmldir = $(docdir)/html 35*81de3bf3SJiri Olsaexdir = $(docdir)/examples 36*81de3bf3SJiri Olsa 37*81de3bf3SJiri OlsaASCIIDOC = asciidoc 38*81de3bf3SJiri OlsaASCIIDOC_EXTRA = --unsafe -f asciidoc.conf 39*81de3bf3SJiri OlsaASCIIDOC_HTML = xhtml11 40*81de3bf3SJiri OlsaMANPAGE_XSL = manpage-normal.xsl 41*81de3bf3SJiri OlsaXMLTO_EXTRA = 42*81de3bf3SJiri OlsaXMLTO =xmlto 43*81de3bf3SJiri Olsa 44*81de3bf3SJiri OlsaINSTALL ?= install 45*81de3bf3SJiri OlsaRM ?= rm -f 46*81de3bf3SJiri Olsa 47*81de3bf3SJiri Olsa# For asciidoc ... 48*81de3bf3SJiri Olsa# -7.1.2, no extra settings are needed. 49*81de3bf3SJiri Olsa# 8.0-, set ASCIIDOC8. 50*81de3bf3SJiri Olsa# 51*81de3bf3SJiri Olsa 52*81de3bf3SJiri Olsa# For docbook-xsl ... 53*81de3bf3SJiri Olsa# -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0) 54*81de3bf3SJiri Olsa# 1.69.0, no extra settings are needed? 55*81de3bf3SJiri Olsa# 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP? 56*81de3bf3SJiri Olsa# 1.71.1, no extra settings are needed? 57*81de3bf3SJiri Olsa# 1.72.0, set DOCBOOK_XSL_172. 58*81de3bf3SJiri Olsa# 1.73.0-, set ASCIIDOC_NO_ROFF 59*81de3bf3SJiri Olsa 60*81de3bf3SJiri Olsa# If you had been using DOCBOOK_XSL_172 in an attempt to get rid 61*81de3bf3SJiri Olsa# of 'the ".ft C" problem' in your generated manpages, and you 62*81de3bf3SJiri Olsa# instead ended up with weird characters around callouts, try 63*81de3bf3SJiri Olsa# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8). 64*81de3bf3SJiri Olsa 65*81de3bf3SJiri Olsaifdef ASCIIDOC8 66*81de3bf3SJiri Olsa ASCIIDOC_EXTRA += -a asciidoc7compatible 67*81de3bf3SJiri Olsaendif 68*81de3bf3SJiri Olsaifdef DOCBOOK_XSL_172 69*81de3bf3SJiri Olsa ASCIIDOC_EXTRA += -a libperf-asciidoc-no-roff 70*81de3bf3SJiri Olsa MANPAGE_XSL = manpage-1.72.xsl 71*81de3bf3SJiri Olsaelse 72*81de3bf3SJiri Olsa ifdef ASCIIDOC_NO_ROFF 73*81de3bf3SJiri Olsa # docbook-xsl after 1.72 needs the regular XSL, but will not 74*81de3bf3SJiri Olsa # pass-thru raw roff codes from asciidoc.conf, so turn them off. 75*81de3bf3SJiri Olsa ASCIIDOC_EXTRA += -a libperf-asciidoc-no-roff 76*81de3bf3SJiri Olsa endif 77*81de3bf3SJiri Olsaendif 78*81de3bf3SJiri Olsaifdef MAN_BOLD_LITERAL 79*81de3bf3SJiri Olsa XMLTO_EXTRA += -m manpage-bold-literal.xsl 80*81de3bf3SJiri Olsaendif 81*81de3bf3SJiri Olsaifdef DOCBOOK_SUPPRESS_SP 82*81de3bf3SJiri Olsa XMLTO_EXTRA += -m manpage-suppress-sp.xsl 83*81de3bf3SJiri Olsaendif 84*81de3bf3SJiri Olsa 85*81de3bf3SJiri OlsaDESTDIR ?= 86*81de3bf3SJiri OlsaDESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' 87*81de3bf3SJiri Olsa 88*81de3bf3SJiri Olsaexport DESTDIR DESTDIR_SQ 89*81de3bf3SJiri Olsa 90*81de3bf3SJiri Olsa# Please note that there is a minor bug in asciidoc. 91*81de3bf3SJiri Olsa# The version after 6.0.3 _will_ include the patch found here: 92*81de3bf3SJiri Olsa# http://marc.theaimsgroup.com/?l=libtraceevent&m=111558757202243&w=2 93*81de3bf3SJiri Olsa# 94*81de3bf3SJiri Olsa# Until that version is released you may have to apply the patch 95*81de3bf3SJiri Olsa# yourself - yes, all 6 characters of it! 96*81de3bf3SJiri Olsa 97*81de3bf3SJiri OlsaQUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir 98*81de3bf3SJiri OlsaQUIET_SUBDIR1 = 99*81de3bf3SJiri Olsa 100*81de3bf3SJiri Olsaifneq ($(findstring $(MAKEFLAGS),w),w) 101*81de3bf3SJiri Olsa PRINT_DIR = --no-print-directory 102*81de3bf3SJiri Olsaelse # "make -w" 103*81de3bf3SJiri Olsa NO_SUBDIR = : 104*81de3bf3SJiri Olsaendif 105*81de3bf3SJiri Olsa 106*81de3bf3SJiri Olsaifneq ($(findstring $(MAKEFLAGS),s),s) 107*81de3bf3SJiri Olsa ifneq ($(V),1) 108*81de3bf3SJiri Olsa QUIET_ASCIIDOC = @echo ' ASCIIDOC '$@; 109*81de3bf3SJiri Olsa QUIET_XMLTO = @echo ' XMLTO '$@; 110*81de3bf3SJiri Olsa endif 111*81de3bf3SJiri Olsaendif 112*81de3bf3SJiri Olsa 113*81de3bf3SJiri Olsaall: $(MAN_X) $(MAN_HTML) 114*81de3bf3SJiri Olsa 115*81de3bf3SJiri Olsa$(MAN_HTML) $(MAN_X): asciidoc.conf 116*81de3bf3SJiri Olsa 117*81de3bf3SJiri Olsainstall-man: all 118*81de3bf3SJiri Olsa $(call QUIET_INSTALL, man) \ 119*81de3bf3SJiri Olsa $(INSTALL) -d -m 755 $(DESTDIR)$(man3dir); \ 120*81de3bf3SJiri Olsa $(INSTALL) -m 644 $(MAN_3) $(DESTDIR)$(man3dir); \ 121*81de3bf3SJiri Olsa $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir); \ 122*81de3bf3SJiri Olsa $(INSTALL) -m 644 $(MAN_7) $(DESTDIR)$(man7dir); 123*81de3bf3SJiri Olsa 124*81de3bf3SJiri Olsainstall-html: 125*81de3bf3SJiri Olsa $(call QUIET_INSTALL, html) \ 126*81de3bf3SJiri Olsa $(INSTALL) -d -m 755 $(DESTDIR)$(htmldir); \ 127*81de3bf3SJiri Olsa $(INSTALL) -m 644 $(MAN_HTML) $(DESTDIR)$(htmldir); \ 128*81de3bf3SJiri Olsa 129*81de3bf3SJiri Olsainstall-examples: 130*81de3bf3SJiri Olsa $(call QUIET_INSTALL, examples) \ 131*81de3bf3SJiri Olsa $(INSTALL) -d -m 755 $(DESTDIR)$(exdir); \ 132*81de3bf3SJiri Olsa $(INSTALL) -m 644 $(MAN_EX) $(DESTDIR)$(exdir); \ 133*81de3bf3SJiri Olsa 134*81de3bf3SJiri OlsaCLEAN_FILES = \ 135*81de3bf3SJiri Olsa $(MAN_XML) $(addsuffix +,$(MAN_XML)) \ 136*81de3bf3SJiri Olsa $(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \ 137*81de3bf3SJiri Olsa $(MAN_X) 1383ce311afSJiri Olsa 1393ce311afSJiri Olsaclean: 140*81de3bf3SJiri Olsa $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES) 141*81de3bf3SJiri Olsa 142*81de3bf3SJiri Olsa$(MAN_3): $(OUTPUT)%.3: %.xml 143*81de3bf3SJiri Olsa $(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< 144*81de3bf3SJiri Olsa 145*81de3bf3SJiri Olsa$(MAN_7): $(OUTPUT)%.7: %.xml 146*81de3bf3SJiri Olsa $(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< 147*81de3bf3SJiri Olsa 148*81de3bf3SJiri Olsa$(MAN_XML): $(OUTPUT)%.xml: %.txt 149*81de3bf3SJiri Olsa $(QUIET_ASCIIDOC)$(ASCIIDOC) -b docbook -d manpage \ 150*81de3bf3SJiri Olsa $(ASCIIDOC_EXTRA) -alibperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ 151*81de3bf3SJiri Olsa mv $@+ $@ 152*81de3bf3SJiri Olsa 153*81de3bf3SJiri Olsa$(MAN_HTML): $(OUTPUT)%.html: %.txt 154*81de3bf3SJiri Olsa $(QUIET_ASCIIDOC)$(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \ 155*81de3bf3SJiri Olsa $(ASCIIDOC_EXTRA) -aperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ 156*81de3bf3SJiri Olsa mv $@+ $@ 157