Tests: Add test to check shared-memory FD leaks after relayd dies
[lttng-tools.git] / doc / man / Makefile.am
CommitLineData
9d16b343
MJ
1# SPDX-License-Identifier: GPL-2.0-only
2
6f6794a6 3# Man pages are only built if they are enabled at configure time.
ceb84f55
PP
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
46d51dbd
OD
10# Local targets.
11LOCAL =
12
ceb84f55
PP
13# List only the names without the .*.txt extension here:
14MAN1_NAMES = \
ba50d967 15 lttng \
7bf169bd 16 lttng-create \
9d4408b8 17 lttng-destroy \
b3903b3a 18 lttng-set-session \
44f5039e 19 lttng-save \
30ec772c 20 lttng-load \
fb58d659 21 lttng-start \
e85eccc8 22 lttng-stop \
79e094df 23 lttng-version \
b4867b3b 24 lttng-view \
4bf0a332 25 lttng-enable-channel \
2e4886b8 26 lttng-disable-channel \
882108c6 27 lttng-add-context \
89dbeff8 28 lttng-list \
882443a6 29 lttng-track \
18d6fa61 30 lttng-untrack \
afaad15a 31 lttng-status \
12397c59 32 lttng-help \
e9b06e2b 33 lttng-snapshot \
290294e8 34 lttng-enable-event \
aec4668a 35 lttng-disable-event \
11533074 36 lttng-crash \
eded6438 37 lttng-metadata \
980bb5fd
PP
38 lttng-regenerate \
39 lttng-rotate \
40 lttng-enable-rotation \
73b818e7 41 lttng-disable-rotation \
a942557f 42 lttng-clear \
0de2479d 43 lttng-add-trigger \
b61776fb 44 lttng-remove-trigger \
0de2479d 45 lttng-list-triggers
ceb84f55 46MAN3_NAMES =
26f0c779 47MAN7_NAMES = lttng-event-rule lttng-concepts
f5595c32 48MAN8_NAMES = lttng-sessiond lttng-relayd
aec4668a 49MAN1_NO_ASCIIDOC_NAMES =
23225252 50MAN3_NO_ASCIIDOC_NAMES = lttng-health-check
484b2a0c 51MAN7_NO_ASCIIDOC_NAMES =
f5595c32 52MAN8_NO_ASCIIDOC_NAMES =
ceb84f55 53
ceb84f55
PP
54# AsciiDoc sources and outputs
55MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
56MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
484b2a0c 57MAN7_TXT = $(call manaddsuffix,.7.txt,$(MAN7_NAMES))
ceb84f55 58MAN8_TXT = $(call manaddsuffix,.8.txt,$(MAN8_NAMES))
484b2a0c 59MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN7_TXT) $(MAN8_TXT)
ceb84f55
PP
60MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
61
62# common AsciiDoc source files
63COMMON_TXT = \
64 $(srcdir)/common-footer.txt \
f5511eea
PP
65 $(srcdir)/common-lttng-cmd-after-options.txt \
66 $(srcdir)/common-lttng-cmd-options-head.txt \
67 $(srcdir)/common-lttng-cmd-help-options.txt \
484b2a0c 68 $(srcdir)/common-help-option.txt \
26f0c779
PP
69 $(srcdir)/common-intro.txt \
70 $(srcdir)/common-daemon-cfg.txt
ceb84f55
PP
71
72# config
767ab8b2 73ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
c4ee4984 74ASCIIDOC_ATTRS_CONF = $(builddir)/asciidoc-attrs.conf
360c4f63 75XSL_FILE = $(srcdir)/manpage.xsl
ceb84f55
PP
76
77# common dependencies
fd3e1238 78COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
ceb84f55 79
a3eae3c9
PP
80# man pages destinations
81MAN1 = $(addsuffix .1,$(MAN1_NAMES))
82MAN3 = $(addsuffix .3,$(MAN3_NAMES))
484b2a0c 83MAN7 = $(addsuffix .7,$(MAN7_NAMES))
a3eae3c9
PP
84MAN8 = $(addsuffix .8,$(MAN8_NAMES))
85MAN1_NO_ASCIIDOC = $(addsuffix .1,$(MAN1_NO_ASCIIDOC_NAMES))
86MAN3_NO_ASCIIDOC = $(addsuffix .3,$(MAN3_NO_ASCIIDOC_NAMES))
484b2a0c 87MAN7_NO_ASCIIDOC = $(addsuffix .7,$(MAN7_NO_ASCIIDOC_NAMES))
a3eae3c9 88MAN8_NO_ASCIIDOC = $(addsuffix .8,$(MAN8_NO_ASCIIDOC_NAMES))
484b2a0c 89MAN = $(MAN1) $(MAN3) $(MAN7) $(MAN8)
a3eae3c9 90
4fc83d94
PP
91# initially empty
92CLEANFILES =
93
94if EMBED_HELP
98477e49
MJ
95mantoh_verbose = $(mantoh_verbose_@AM_V@)
96mantoh_verbose_ = $(mantoh_verbose_@AM_DEFAULT_V@)
97mantoh_verbose_0 = @echo " MANTOH " $@;
98
4fc83d94
PP
99MAN1_H = $(addsuffix .1.h,$(MAN1_NAMES))
100MAN3_H = $(addsuffix .3.h,$(MAN3_NAMES))
101MAN8_H = $(addsuffix .8.h,$(MAN8_NAMES))
102MAN_H = $(MAN1_H) $(MAN3_H) $(MAN8_H)
103MAN_H_RECIPE = \
98477e49 104 $(mantoh_verbose_0)\
4fc83d94
PP
105 MANWIDTH=80 @MANPROG@ --encoding=UTF-8 --no-hyphenation --no-justification --local-file $< > $@ ; \
106 $(SED) -i 's/\\/\\\\/g' $@ ; \
107 $(SED) -i 's/"/\\"/g' $@ ; \
108 $(SED) -i 's/^\(.*\)$$/"\1\\n"/' $@
109
110%.1.h: %.1
111 $(MAN_H_RECIPE)
112
113%.3.h: %.3
114 $(MAN_H_RECIPE)
115
116%.8.h: %.8
117 $(MAN_H_RECIPE)
118
46d51dbd 119LOCAL += $(MAN_H)
4fc83d94
PP
120
121CLEANFILES += $(MAN_H)
122endif # EMBED_HELP
123
a3eae3c9
PP
124if MAN_PAGES_OPT
125# at this point, we know the user asked to build the man pages
126if HAVE_ASCIIDOC_XMLTO
98477e49
MJ
127
128asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
129asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
130asciidoc_verbose_0 = @echo " ASCIIDOC " $@;
131
132xmlto_verbose = $(xmlto_verbose_@AM_V@)
133xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
134xmlto_verbose_0 = @echo " XMLTO " $@;
135
ceb84f55 136# tools
98477e49 137ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -f $(ASCIIDOC_ATTRS_CONF) -d manpage
ceb84f55 138ADOC_DOCBOOK = $(ADOC) -b docbook
360c4f63 139XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_FILE) man
ceb84f55 140
fd3e1238
PP
141# only add this dependency if we can build the man pages because it's
142# a file generated by the configure script, so it's more recent than
143# the pregenerated man pages in a tarball
144COMMON_DEPS += $(ASCIIDOC_ATTRS_CONF)
145
ceb84f55
PP
146# recipes
147%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
148 $(ADOC_DOCBOOK) -o $@ $<
149
360c4f63 150%.1: %.1.xml $(XSL_FILE)
98477e49 151 $(XTO) $< 2>/dev/null
ceb84f55
PP
152
153%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
154 $(ADOC_DOCBOOK) -o $@ $<
155
360c4f63 156%.3: %.3.xml $(XSL_FILE)
98477e49 157 $(XTO) $< 2>/dev/null
ceb84f55 158
484b2a0c
PP
159%.7.xml: $(srcdir)/%.7.txt $(COMMON_DEPS)
160 $(ADOC_DOCBOOK) -o $@ $<
161
162%.7: %.7.xml $(XSL_FILE)
163 $(XTO) $< 2>/dev/null
164
ceb84f55
PP
165%.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
166 $(ADOC_DOCBOOK) -o $@ $<
167
360c4f63 168%.8: %.8.xml $(XSL_FILE)
98477e49 169 $(XTO) $< 2>/dev/null
ceb84f55 170
a3eae3c9 171# only clean the generated files if we have the tools to generate them again
4fc83d94 172CLEANFILES += $(MAN_XML) $(MAN)
a3eae3c9
PP
173else # HAVE_ASCIIDOC_XMLTO
174# create man page targets used to stop the build if we want to
175# build the man pages, but we don't have the necessary tools to do so
176ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
177ERR_MSG += "Make sure both tools are installed and run the configure script again."
178
179%.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
180 @echo $(ERR_MSG)
181 @false
182
183%.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
184 @echo $(ERR_MSG)
185 @false
186
484b2a0c
PP
187%.7: $(srcdir)/%.7.txt $(COMMON_DEPS)
188 @echo $(ERR_MSG)
189 @false
190
a3eae3c9
PP
191%.8: $(srcdir)/%.8.txt $(COMMON_DEPS)
192 @echo $(ERR_MSG)
ceb84f55 193 @false
a3eae3c9
PP
194endif # HAVE_ASCIIDOC_XMLTO
195endif # MAN_PAGES_OPT
196
197# those are always installed since they are directly written in troff
198dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
199dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
484b2a0c 200dist_man7_MANS = $(MAN7_NO_ASCIIDOC)
a3eae3c9
PP
201dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
202
203if MAN_PAGES_OPT
204# building man pages: we can install and distribute them
ceb84f55
PP
205dist_man1_MANS += $(MAN1)
206dist_man3_MANS += $(MAN3)
484b2a0c 207dist_man7_MANS += $(MAN7)
ceb84f55 208dist_man8_MANS += $(MAN8)
a3eae3c9
PP
209endif # MAN_PAGES_OPT
210
46d51dbd
OD
211MAN_HIERARCHY = man1 man3 man7 man8
212
213LOCAL += $(MAN_HIERARCHY)
214
215CLEANFILES += $(MAN_HIERARCHY)
216
217# Mimic mandb(8) path hierarchy -- as if installed -- by symlinking
218# sub-directories to the top man directory. This allows developers to read
219# the locally generated man pages. For example `$ ./pre-inst-env man lttng'.
220man1:
221 @ln -s $(abs_builddir) $@
222
223man3:
224 @ln -s $(abs_builddir) $@
225
226man7:
227 @ln -s $(abs_builddir) $@
228
229man8:
230 @ln -s $(abs_builddir) $@
231
2f1c0906
PP
232if !MAN_PAGES_OPT
233dist-hook:
234 @echo "Error: Please enable the man pages before creating a distribution tarball."
235 @false
236endif # !MAN_PAGES_OPT
237
a3eae3c9 238# always distribute the source files
360c4f63 239EXTRA_DIST = $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) \
c4ee4984 240 $(ASCIIDOC_CONF) $(ASCIIDOC_ATTRS_CONF).in
4fc83d94 241
46d51dbd
OD
242# Build local targets.
243all-local: $(LOCAL)
244
4fc83d94 245# keep generated man pages that can be considered intermediate files
484b2a0c 246.PRECIOUS: %.1 %.3 %.7 %.8
This page took 0.059478 seconds and 5 git commands to generate.