event-rule: introduce event rule syscall
[lttng-tools.git] / doc / man / Makefile.am
... / ...
CommitLineData
1# SPDX-License-Identifier: GPL-2.0-only
2
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 \
13 lttng-create \
14 lttng-destroy \
15 lttng-set-session \
16 lttng-save \
17 lttng-load \
18 lttng-start \
19 lttng-stop \
20 lttng-version \
21 lttng-view \
22 lttng-enable-channel \
23 lttng-disable-channel \
24 lttng-add-context \
25 lttng-list \
26 lttng-track \
27 lttng-untrack \
28 lttng-status \
29 lttng-help \
30 lttng-snapshot \
31 lttng-enable-event \
32 lttng-disable-event \
33 lttng-crash \
34 lttng-metadata \
35 lttng-regenerate \
36 lttng-rotate \
37 lttng-enable-rotation \
38 lttng-disable-rotation \
39 lttng-clear
40MAN3_NAMES =
41MAN8_NAMES = lttng-sessiond lttng-relayd
42MAN1_NO_ASCIIDOC_NAMES =
43MAN3_NO_ASCIIDOC_NAMES = lttng-health-check
44MAN8_NO_ASCIIDOC_NAMES =
45
46# AsciiDoc sources and outputs
47MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
48MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
49MAN8_TXT = $(call manaddsuffix,.8.txt,$(MAN8_NAMES))
50MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
51MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
52
53# common AsciiDoc source files
54COMMON_TXT = \
55 $(srcdir)/common-footer.txt \
56 $(srcdir)/common-cmd-footer.txt \
57 $(srcdir)/common-cmd-options-head.txt \
58 $(srcdir)/common-cmd-help-options.txt
59
60# config
61ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
62ASCIIDOC_ATTRS_CONF = $(builddir)/asciidoc-attrs.conf
63XSL_FILE = $(srcdir)/manpage.xsl
64
65# common dependencies
66COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
67
68# man pages destinations
69MAN1 = $(addsuffix .1,$(MAN1_NAMES))
70MAN3 = $(addsuffix .3,$(MAN3_NAMES))
71MAN8 = $(addsuffix .8,$(MAN8_NAMES))
72MAN1_NO_ASCIIDOC = $(addsuffix .1,$(MAN1_NO_ASCIIDOC_NAMES))
73MAN3_NO_ASCIIDOC = $(addsuffix .3,$(MAN3_NO_ASCIIDOC_NAMES))
74MAN8_NO_ASCIIDOC = $(addsuffix .8,$(MAN8_NO_ASCIIDOC_NAMES))
75MAN = $(MAN1) $(MAN3) $(MAN8)
76
77# initially empty
78CLEANFILES =
79
80if EMBED_HELP
81mantoh_verbose = $(mantoh_verbose_@AM_V@)
82mantoh_verbose_ = $(mantoh_verbose_@AM_DEFAULT_V@)
83mantoh_verbose_0 = @echo " MANTOH " $@;
84
85MAN1_H = $(addsuffix .1.h,$(MAN1_NAMES))
86MAN3_H = $(addsuffix .3.h,$(MAN3_NAMES))
87MAN8_H = $(addsuffix .8.h,$(MAN8_NAMES))
88MAN_H = $(MAN1_H) $(MAN3_H) $(MAN8_H)
89MAN_H_RECIPE = \
90 $(mantoh_verbose_0)\
91 MANWIDTH=80 @MANPROG@ --encoding=UTF-8 --no-hyphenation --no-justification --local-file $< > $@ ; \
92 $(SED) -i 's/\\/\\\\/g' $@ ; \
93 $(SED) -i 's/"/\\"/g' $@ ; \
94 $(SED) -i 's/^\(.*\)$$/"\1\\n"/' $@
95
96%.1.h: %.1
97 $(MAN_H_RECIPE)
98
99%.3.h: %.3
100 $(MAN_H_RECIPE)
101
102%.8.h: %.8
103 $(MAN_H_RECIPE)
104
105all-local: $(MAN_H)
106
107CLEANFILES += $(MAN_H)
108endif # EMBED_HELP
109
110if MAN_PAGES_OPT
111# at this point, we know the user asked to build the man pages
112if HAVE_ASCIIDOC_XMLTO
113
114asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
115asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
116asciidoc_verbose_0 = @echo " ASCIIDOC " $@;
117
118xmlto_verbose = $(xmlto_verbose_@AM_V@)
119xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
120xmlto_verbose_0 = @echo " XMLTO " $@;
121
122# tools
123ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -f $(ASCIIDOC_ATTRS_CONF) -d manpage
124ADOC_DOCBOOK = $(ADOC) -b docbook
125XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_FILE) man
126
127# only add this dependency if we can build the man pages because it's
128# a file generated by the configure script, so it's more recent than
129# the pregenerated man pages in a tarball
130COMMON_DEPS += $(ASCIIDOC_ATTRS_CONF)
131
132# recipes
133%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
134 $(ADOC_DOCBOOK) -o $@ $<
135
136%.1: %.1.xml $(XSL_FILE)
137 $(XTO) $< 2>/dev/null
138
139%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
140 $(ADOC_DOCBOOK) -o $@ $<
141
142%.3: %.3.xml $(XSL_FILE)
143 $(XTO) $< 2>/dev/null
144
145%.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
146 $(ADOC_DOCBOOK) -o $@ $<
147
148%.8: %.8.xml $(XSL_FILE)
149 $(XTO) $< 2>/dev/null
150
151# only clean the generated files if we have the tools to generate them again
152CLEANFILES += $(MAN_XML) $(MAN)
153else # HAVE_ASCIIDOC_XMLTO
154# create man page targets used to stop the build if we want to
155# build the man pages, but we don't have the necessary tools to do so
156ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
157ERR_MSG += "Make sure both tools are installed and run the configure script again."
158
159%.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
160 @echo $(ERR_MSG)
161 @false
162
163%.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
164 @echo $(ERR_MSG)
165 @false
166
167%.8: $(srcdir)/%.8.txt $(COMMON_DEPS)
168 @echo $(ERR_MSG)
169 @false
170endif # HAVE_ASCIIDOC_XMLTO
171endif # MAN_PAGES_OPT
172
173# those are always installed since they are directly written in troff
174dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
175dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
176dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
177
178if MAN_PAGES_OPT
179# building man pages: we can install and distribute them
180dist_man1_MANS += $(MAN1)
181dist_man3_MANS += $(MAN3)
182dist_man8_MANS += $(MAN8)
183endif # MAN_PAGES_OPT
184
185if !MAN_PAGES_OPT
186dist-hook:
187 @echo "Error: Please enable the man pages before creating a distribution tarball."
188 @false
189endif # !MAN_PAGES_OPT
190
191# always distribute the source files
192EXTRA_DIST = $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) \
193 $(ASCIIDOC_CONF) $(ASCIIDOC_ATTRS_CONF).in
194
195# keep generated man pages that can be considered intermediate files
196.PRECIOUS: %.1 %.3 %.8
This page took 0.02396 seconds and 5 git commands to generate.