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