Build system: implement REUSE with SPDX identifiers
[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:
e02d8dc3 79ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
82f9bfc0
SM
80 -a mansource="LTTng" \
81 -a manmanual="LTTng Manual" \
82 -a manversion="$(PACKAGE_VERSION)"
6f97f9c2 83
4ddbd0b7 84ADOC_DOCBOOK = $(ADOC) -b docbook
e02d8dc3 85XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_FILE) man
4ddbd0b7
PP
86
87# Recipes:
88%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
89 $(ADOC_DOCBOOK) -o $@ $<
90
6bf962a4 91%.1: %.1.xml $(XSL_FILE)
d8e38296 92 $(XTO) $< $(xmlto_verbose_out)
4ddbd0b7
PP
93
94%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
95 $(ADOC_DOCBOOK) -o $@ $<
96
7fce6bd5
PP
97# These pair of files are generated by a single invocation of xmlto, use
98# an empty rule that depends on a fake intermediate file to track the
99# dependencies without resorting to Group Targets which were only
100# introduced in GNU Make 4.3.
5b1163c6
PP
101lttng_ust_tracef.3 lttng_ust_vtracef.3: lttng_ust_tracef.3.alias
102 @# Empty recipe to mark lttng_ust_tracef.3 and lttng_ust_vtracef.3 as rebuilt
103
104lttng_ust_tracelog.3 lttng_ust_vtracelog.3: lttng_ust_tracelog.3.alias
105 @# Empty recipe to mark lttng_ust_tracelog.3 and lttng_ust_vtracelog.3 as rebuilt
106
107
108.INTERMEDIATE: tracef.3.alias tracelog.3.alias lttng_ust_tracef.3.alias lttng_ust_tracelog.3.alias
02275a1d
MJ
109
110tracef.3.alias: tracef.3.xml $(XSL_FILE)
d8e38296 111 $(XTO) $< $(xmlto_verbose_out)
8cbeea02 112
02275a1d 113tracelog.3.alias: tracelog.3.xml $(XSL_FILE)
d8e38296 114 $(XTO) $< $(xmlto_verbose_out)
8cbeea02 115
5b1163c6
PP
116lttng_ust_tracef.3.alias: lttng_ust_tracef.3.xml $(XSL_FILE)
117 $(XTO) $< $(xmlto_verbose_out)
118
119lttng_ust_tracelog.3.alias: lttng_ust_tracelog.3.xml $(XSL_FILE)
120 $(XTO) $< $(xmlto_verbose_out)
121
6bf962a4 122%.3: %.3.xml $(XSL_FILE)
d8e38296 123 $(XTO) $< $(xmlto_verbose_out)
4ddbd0b7
PP
124
125# Only clean the generated files if we have the tools to generate them again.
126CLEANFILES = $(MAN_XML) $(MAN)
127else # HAVE_ASCIIDOC_XMLTO
128# Create man page targets used to stop the build if we want to
129# build the man pages, but we don't have the necessary tools to do so.
130ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
131ERR_MSG += "Make sure both tools are installed and run the configure script again."
132
133%.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
134 @echo $(ERR_MSG)
135 @false
136
137%.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
138 @echo $(ERR_MSG)
139 @false
140endif # HAVE_ASCIIDOC_XMLTO
41ad81d8 141endif # ENABLE_MAN_PAGES
4ddbd0b7
PP
142
143# Start with empty distributed/installed man pages:
144dist_man1_MANS =
145dist_man3_MANS =
146EXTRA_DIST =
147
41ad81d8 148if ENABLE_MAN_PAGES
4ddbd0b7
PP
149# Building man pages: we can install and distribute them.
150dist_man1_MANS += $(MAN1)
151dist_man3_MANS += $(MAN3) $(MAN3_TROFF)
41ad81d8 152else # ENABLE_MAN_PAGES
4ddbd0b7
PP
153# Those are not known by automake yet because dist_man3_MANS is empty
154# at this point, so make sure they are distributed.
155EXTRA_DIST += $(MAN3_TROFF)
41ad81d8 156endif # ENABLE_MAN_PAGES
4ddbd0b7 157
41ad81d8 158if !ENABLE_MAN_PAGES
4ddbd0b7
PP
159dist-hook:
160 @echo "Error: Please enable the man pages before creating a distribution tarball."
161 @false
41ad81d8 162endif # !ENABLE_MAN_PAGES
4ddbd0b7
PP
163
164# Always distribute the source files.
e6e508c9 165EXTRA_DIST += $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) $(ASCIIDOC_CONF) README.md
This page took 0.035153 seconds and 4 git commands to generate.