Rename "tsc" to "timestamp"
[lttng-ust.git] / doc / man / Makefile.am
CommitLineData
e03d7c66
MJ
1# SPDX-FileCopyrightText: 2023 EfficiOS, Inc
2#
c0c0989a
MJ
3# SPDX-License-Identifier: LGPL-2.1-only
4
4ddbd0b7
PP
5# Man pages are only built if they are enabled at configure time.
6#
7# They should always be built before creating a distribution tarball.
8
9# Function which adds the source directory prefix and adds a given suffix:
10manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
11
12# List only the names without the .*.txt extension here:
13MAN1_NAMES = \
14 lttng-gen-tp
15MAN3_NAMES = \
16 lttng-ust \
4ddbd0b7 17 lttng-ust-dl \
5b1163c6
PP
18 lttng-ust-cyg-profile \
19 lttng_ust_tracef \
20 lttng_ust_tracelog \
21 tracef \
22 tracelog
4ddbd0b7 23
8cbeea02 24# Man page aliases (generated from other sources):
7fce6bd5 25MAN3_ALIASES = lttng_ust_vtracef.3 lttng_ust_vtracelog.3
8cbeea02 26
4ddbd0b7 27# troff man pages:
5b1163c6
PP
28MAN3_TROFF = \
29 do_tracepoint.3 \
30 lttng_ust_do_tracepoint.3 \
31 lttng_ust_tracepoint.3 \
32 lttng_ust_tracepoint_enabled.3 \
33 tracepoint.3 \
34 tracepoint_enabled.3
4ddbd0b7
PP
35
36# AsciiDoc sources and outputs:
37MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
38MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
39MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
40MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
41
42# Common AsciiDoc source files:
43COMMON_TXT = \
44 $(srcdir)/common-footer.txt \
45 $(srcdir)/common-authors.txt \
46 $(srcdir)/common-copyrights.txt \
47 $(srcdir)/log-levels.txt \
48 $(srcdir)/tracef-tracelog-limitations.txt
49
50# AsciiDoc configuration and XSL files:
51ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
6bf962a4 52XSL_FILE = $(srcdir)/manpage.xsl
4ddbd0b7
PP
53
54# Common dependencies:
55COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
56
57# Man pages destinations:
58MAN1 = $(addsuffix .1,$(MAN1_NAMES))
8cbeea02 59MAN3 = $(addsuffix .3,$(MAN3_NAMES)) $(MAN3_ALIASES)
4ddbd0b7
PP
60MAN = $(MAN1) $(MAN3)
61
41ad81d8 62if ENABLE_MAN_PAGES
4ddbd0b7
PP
63# At this point, we know the user asked to build the man pages.
64if HAVE_ASCIIDOC_XMLTO
e02d8dc3
MJ
65
66asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
67asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
68asciidoc_verbose_0 = @echo " ASCIIDOC " $@;
69
70xmlto_verbose = $(xmlto_verbose_@AM_V@)
71xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
72xmlto_verbose_0 = @echo " XMLTO " $@;
73
d8e38296
MJ
74xmlto_verbose_out = $(xmlto_verbose_out_@AM_V@)
75xmlto_verbose_out_ = $(xmlto_verbose_out_@AM_DEFAULT_V@)
76xmlto_verbose_out_0 = 2>/dev/null
77
4ddbd0b7 78# Tools to execute:
5cc87292 79ADOC = $(asciidoc_verbose)$(ASCIIDOC) -v -f $(ASCIIDOC_CONF) -d manpage \
82f9bfc0
SM
80 -a mansource="LTTng" \
81 -a manmanual="LTTng Manual" \
5cc87292
KS
82 -a manversion="$(PACKAGE_VERSION)" \
83 -a lttng_version="$(LTTNG_UST_MAJOR_VERSION).$(LTTNG_UST_MINOR_VERSION)"
6f97f9c2 84
4ddbd0b7 85ADOC_DOCBOOK = $(ADOC) -b docbook
5cc87292 86XTO = $(xmlto_verbose)$(XMLTO) -v -m $(XSL_FILE) man
4ddbd0b7
PP
87
88# Recipes:
89%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
90 $(ADOC_DOCBOOK) -o $@ $<
91
6bf962a4 92%.1: %.1.xml $(XSL_FILE)
d8e38296 93 $(XTO) $< $(xmlto_verbose_out)
4ddbd0b7
PP
94
95%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
96 $(ADOC_DOCBOOK) -o $@ $<
97
7fce6bd5
PP
98# These pair of files are generated by a single invocation of xmlto, use
99# an empty rule that depends on a fake intermediate file to track the
100# dependencies without resorting to Group Targets which were only
101# introduced in GNU Make 4.3.
5b1163c6
PP
102lttng_ust_tracef.3 lttng_ust_vtracef.3: lttng_ust_tracef.3.alias
103 @# Empty recipe to mark lttng_ust_tracef.3 and lttng_ust_vtracef.3 as rebuilt
104
105lttng_ust_tracelog.3 lttng_ust_vtracelog.3: lttng_ust_tracelog.3.alias
106 @# Empty recipe to mark lttng_ust_tracelog.3 and lttng_ust_vtracelog.3 as rebuilt
107
108
109.INTERMEDIATE: tracef.3.alias tracelog.3.alias lttng_ust_tracef.3.alias lttng_ust_tracelog.3.alias
02275a1d
MJ
110
111tracef.3.alias: tracef.3.xml $(XSL_FILE)
d8e38296 112 $(XTO) $< $(xmlto_verbose_out)
8cbeea02 113
02275a1d 114tracelog.3.alias: tracelog.3.xml $(XSL_FILE)
d8e38296 115 $(XTO) $< $(xmlto_verbose_out)
8cbeea02 116
5b1163c6
PP
117lttng_ust_tracef.3.alias: lttng_ust_tracef.3.xml $(XSL_FILE)
118 $(XTO) $< $(xmlto_verbose_out)
119
120lttng_ust_tracelog.3.alias: lttng_ust_tracelog.3.xml $(XSL_FILE)
121 $(XTO) $< $(xmlto_verbose_out)
122
6bf962a4 123%.3: %.3.xml $(XSL_FILE)
d8e38296 124 $(XTO) $< $(xmlto_verbose_out)
4ddbd0b7
PP
125
126# Only clean the generated files if we have the tools to generate them again.
127CLEANFILES = $(MAN_XML) $(MAN)
128else # HAVE_ASCIIDOC_XMLTO
129# Create man page targets used to stop the build if we want to
130# build the man pages, but we don't have the necessary tools to do so.
131ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
132ERR_MSG += "Make sure both tools are installed and run the configure script again."
133
134%.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
135 @echo $(ERR_MSG)
136 @false
137
138%.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
139 @echo $(ERR_MSG)
140 @false
141endif # HAVE_ASCIIDOC_XMLTO
41ad81d8 142endif # ENABLE_MAN_PAGES
4ddbd0b7
PP
143
144# Start with empty distributed/installed man pages:
145dist_man1_MANS =
146dist_man3_MANS =
147EXTRA_DIST =
148
41ad81d8 149if ENABLE_MAN_PAGES
4ddbd0b7
PP
150# Building man pages: we can install and distribute them.
151dist_man1_MANS += $(MAN1)
152dist_man3_MANS += $(MAN3) $(MAN3_TROFF)
41ad81d8 153else # ENABLE_MAN_PAGES
4ddbd0b7
PP
154# Those are not known by automake yet because dist_man3_MANS is empty
155# at this point, so make sure they are distributed.
156EXTRA_DIST += $(MAN3_TROFF)
41ad81d8 157endif # ENABLE_MAN_PAGES
4ddbd0b7 158
41ad81d8 159if !ENABLE_MAN_PAGES
4ddbd0b7
PP
160dist-hook:
161 @echo "Error: Please enable the man pages before creating a distribution tarball."
162 @false
41ad81d8 163endif # !ENABLE_MAN_PAGES
4ddbd0b7
PP
164
165# Always distribute the source files.
e6e508c9 166EXTRA_DIST += $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) $(ASCIIDOC_CONF) README.md
This page took 0.038584 seconds and 5 git commands to generate.