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