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