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