xref: /aosp_15_r20/external/trace-cmd/Documentation/Makefile (revision 58e6ee5f017f6a8912852c892d18457e4bafb554)
1# SPDX-License-Identifier: GPL-2.0
2
3doc_dir:=$(src)/Documentation
4
5export doc_dir
6
7SUBDIR += trace-cmd
8SUBDIR += libtracecmd
9
10.PHONY: $(SUBDIR)
11
12DOCDIR = $(src)/Documentation
13ASCIIDOC=asciidoc
14ASCIIDOC_CONF	 =  $(DOCDIR)/asciidoc.conf
15ASCIIDOC_EXTRA = --unsafe -f $(ASCIIDOC_CONF)
16ASCIIDOC_HTML = xhtml11
17MANPAGE_XSL = $(DOCDIR)/manpage-normal.xsl
18XMLTO_EXTRA =
19INSTALL?=install
20RM ?= rm -f
21
22ASCIIDOC_INSTALLED := $(shell command -v $(ASCIIDOC) 2> /dev/null)
23ifndef ASCIIDOC_INSTALLED
24	missing_tools += $(ASCIIDOC)
25endif
26
27XMLTO=xmlto
28XMLTO_INSTALLED := $(shell command -v $(XMLTO) 2> /dev/null)
29ifndef XMLTO_INSTALLED
30	missing_tools += $(XMLTO)
31endif
32
33#
34# For asciidoc ...
35#	-7.1.2,	no extra settings are needed.
36#	8.0-,	set ASCIIDOC8.
37#
38
39#
40# For docbook-xsl ...
41#	-1.68.1,	set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
42#	1.69.0,		no extra settings are needed?
43#	1.69.1-1.71.0,	set DOCBOOK_SUPPRESS_SP?
44#	1.71.1,		no extra settings are needed?
45#	1.72.0,		set DOCBOOK_XSL_172.
46#	1.73.0-,	set ASCIIDOC_NO_ROFF
47#
48
49#
50# If you had been using DOCBOOK_XSL_172 in an attempt to get rid
51# of 'the ".ft C" problem' in your generated manpages, and you
52# instead ended up with weird characters around callouts, try
53# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
54#
55
56ifdef ASCIIDOC8
57ASCIIDOC_EXTRA += -a asciidoc7compatible
58endif
59ifdef DOCBOOK_XSL_172
60ASCIIDOC_EXTRA += -a libtracecmd-asciidoc-no-roff
61MANPAGE_XSL = $(DOCDIR)/manpage-1.72.xsl
62else
63	ifdef ASCIIDOC_NO_ROFF
64	# docbook-xsl after 1.72 needs the regular XSL, but will not
65	# pass-thru raw roff codes from asciidoc.conf, so turn them off.
66	ASCIIDOC_EXTRA += -a libtracecmd-asciidoc-no-roff
67	endif
68endif
69ifdef MAN_BOLD_LITERAL
70XMLTO_EXTRA += -m $(DOCDIR)/manpage-bold-literal.xsl
71endif
72ifdef DOCBOOK_SUPPRESS_SP
73XMLTO_EXTRA += -m $(DOCDIR)/manpage-suppress-sp.xsl
74endif
75
76ifdef USE_ASCIIDOCTOR
77ASCIIDOC = asciidoctor
78ASCIIDOC_EXTRA = -a compat-mode
79ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
80ASCIIDOC_HTML = xhtml5
81endif
82
83ifneq ($(findstring $(MAKEFLAGS),w),w)
84PRINT_DIR = --no-print-directory
85else # "make -w"
86NO_SUBDIR = :
87endif
88
89export ASCIIDOC ASCIIDOC_CONF ASCIIDOC_EXTRA ASCIIDOC_HTML
90export MANPAGE_XSL
91export XMLTO XMLTO_INSTALLED XMLTO_EXTRA
92export  missing_tools
93export RM
94
95all: $(SUBDIR)
96clean: $(SUBDIR)
97install: $(SUBDIR)
98
99$(SUBDIR):
100	make -C $@ $(MAKECMDGOALS)
101
102