Move to kernel style SPDX license identifiers
[babeltrace.git] / doc / man / Makefile.am
CommitLineData
0235b0db
MJ
1# SPDX-License-Identifier: MIT
2
0659f3af
PP
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 = \
a8be4294
MJ
12 babeltrace2 \
13 babeltrace2-convert \
14 babeltrace2-help \
15 babeltrace2-list-plugins \
a8be4294
MJ
16 babeltrace2-query \
17 babeltrace2-run
18MAN7_NAMES = babeltrace2-filter.utils.muxer \
19 babeltrace2-filter.utils.trimmer \
20 babeltrace2-intro \
21 babeltrace2-plugin-ctf \
22 babeltrace2-plugin-text \
23 babeltrace2-plugin-utils \
24 babeltrace2-sink.ctf.fs \
25 babeltrace2-sink.text.pretty \
e70712b3 26 babeltrace2-sink.text.details \
a8be4294
MJ
27 babeltrace2-sink.utils.counter \
28 babeltrace2-sink.utils.dummy \
29 babeltrace2-source.ctf.fs \
30 babeltrace2-source.ctf.lttng-live \
e70712b3
PP
31 babeltrace2-source.text.dmesg \
32 babeltrace2-query-babeltrace.support-info \
33 babeltrace2-query-babeltrace.trace-infos
dbce3403
PP
34MAN1_NO_ASCIIDOC_NAMES =
35MAN7_NO_ASCIIDOC_NAMES =
0659f3af
PP
36
37if ENABLE_DEBUG_INFO
dbce3403 38MAN7_NAMES += \
a8be4294
MJ
39 babeltrace2-plugin-lttng-utils \
40 babeltrace2-filter.lttng-utils.debug-info
0659f3af
PP
41endif
42
43# AsciiDoc sources and outputs
44MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
45MAN7_TXT = $(call manaddsuffix,.7.txt,$(MAN7_NAMES))
46MAN_TXT = $(MAN1_TXT) $(MAN7_TXT)
47MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
48
49# common AsciiDoc source files
50COMMON_TXT = \
51 $(srcdir)/common-cli-env.txt \
52 $(srcdir)/common-cli-files.txt \
53 $(srcdir)/common-cmd-footer.txt \
54 $(srcdir)/common-cmd-info-options.txt \
55 $(srcdir)/common-cmd-params-format.txt \
e70712b3 56 $(srcdir)/common-common-env.txt \
0659f3af
PP
57 $(srcdir)/common-footer.txt \
58 $(srcdir)/common-gen-options.txt \
59 $(srcdir)/common-lib-env.txt \
e70712b3
PP
60 $(srcdir)/common-see-babeltrace2-intro.txt \
61 $(srcdir)/common-convert-examples.txt \
62 $(srcdir)/common-log-levels.txt \
63 $(srcdir)/common-trimmer-time-format.txt
0659f3af
PP
64
65# config
66ASCIIDOC_CONF = $(srcdir)/bt-asciidoc.conf
67ASCIIDOC_ATTRS_CONF = $(builddir)/asciidoc-attrs.conf
68XSL_SRC_FILE = $(srcdir)/manpage.xsl
69
70# common dependencies
71COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
72
73# man pages destinations
74MAN1 = $(addsuffix .1,$(MAN1_NAMES))
75MAN7 = $(addsuffix .7,$(MAN7_NAMES))
76MAN1_NO_ASCIIDOC = $(addsuffix .1,$(MAN1_NO_ASCIIDOC_NAMES))
77MAN7_NO_ASCIIDOC = $(addsuffix .7,$(MAN7_NO_ASCIIDOC_NAMES))
78MAN = $(MAN1) $(MAN7)
79
80if ENABLE_MAN_PAGES
81# at this point, we know the user asked to build the man pages
82if HAVE_ASCIIDOC_XMLTO
83asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
84asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
85asciidoc_verbose_0 = @echo " ASCIIDOC " $@;
86xmlto_verbose = $(xmlto_verbose_@AM_V@)
87xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
88xmlto_verbose_0 = @echo " XMLTO " $@;
89
90# tools
91ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -f $(ASCIIDOC_ATTRS_CONF) -d manpage
92ADOC_DOCBOOK = $(ADOC) -b docbook
93XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_SRC_FILE) man
94
95# only add this dependency if we can build the man pages because it's
96# a file generated by the configure script, so it's more recent than
97# the pregenerated man pages in a tarball
98COMMON_DEPS += $(ASCIIDOC_ATTRS_CONF)
99
100# recipes
101%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
102 $(ADOC_DOCBOOK) -o $@ $<
103
104%.1: %.1.xml $(XSL_SRC_FILE)
105 $(XTO) $< 2>/dev/null
106
107%.7.xml: $(srcdir)/%.7.txt $(COMMON_DEPS)
108 $(ADOC_DOCBOOK) -o $@ $<
109
110%.7: %.7.xml $(XSL_SRC_FILE)
111 $(XTO) $< 2>/dev/null
112
113# only clean the generated files if we have the tools to generate them again
114CLEANFILES = $(MAN_XML) $(MAN)
115else # HAVE_ASCIIDOC_XMLTO
116# create man page targets used to stop the build if we want to
117# build the man pages, but we don't have the necessary tools to do so
118ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
119ERR_MSG += "Make sure both tools are installed and run the configure script again."
120
121%.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
122 @echo $(ERR_MSG)
123 @false
124
125%.7: $(srcdir)/%.7.txt $(COMMON_DEPS)
126 @echo $(ERR_MSG)
127 @false
128endif # HAVE_ASCIIDOC_XMLTO
129endif # ENABLE_MAN_PAGES
130
131# those are always installed since they are directly written in troff
132dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
133dist_man7_MANS = $(MAN7_NO_ASCIIDOC)
134
135if ENABLE_MAN_PAGES
136# building man pages: we can install and distribute them
137dist_man1_MANS += $(MAN1)
138dist_man7_MANS += $(MAN7)
139endif # ENABLE_MAN_PAGES
140
141if !ENABLE_MAN_PAGES
142dist-hook:
143 @echo "Error: Please enable the man pages before creating a distribution tarball."
144 @false
145endif # !ENABLE_MAN_PAGES
146
147# always distribute the source files
148EXTRA_DIST = README.adoc $(MAN_TXT) $(COMMON_TXT) $(XSL_SRC_FILE) \
149 $(ASCIIDOC_CONF) $(ASCIIDOC_ATTRS_CONF).in
This page took 0.049452 seconds and 4 git commands to generate.