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