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