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