1 # Man pages are only built if they are enabled at configure time.
3 # They should always be built before creating a distribution tarball.
5 # function which adds the source directory prefix and adds a given suffix
6 manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
8 # List only the names without the .*.txt extension here:
13 babeltrace2-list-plugins \
16 MAN7_NAMES = babeltrace2-filter.utils.muxer \
17 babeltrace2-filter.utils.trimmer \
19 babeltrace2-plugin-ctf \
20 babeltrace2-plugin-text \
21 babeltrace2-plugin-utils \
22 babeltrace2-sink.ctf.fs \
23 babeltrace2-sink.text.pretty \
24 babeltrace2-sink.utils.counter \
25 babeltrace2-sink.utils.dummy \
26 babeltrace2-source.ctf.fs \
27 babeltrace2-source.ctf.lttng-live \
28 babeltrace2-source.text.dmesg
29 MAN1_NO_ASCIIDOC_NAMES =
30 MAN7_NO_ASCIIDOC_NAMES =
34 babeltrace2-plugin-lttng-utils \
35 babeltrace2-filter.lttng-utils.debug-info
38 # AsciiDoc sources and outputs
39 MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
40 MAN7_TXT = $(call manaddsuffix,.7.txt,$(MAN7_NAMES))
41 MAN_TXT = $(MAN1_TXT) $(MAN7_TXT)
42 MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
44 # common AsciiDoc source files
46 $(srcdir)/common-cli-env.txt \
47 $(srcdir)/common-cli-files.txt \
48 $(srcdir)/common-cmd-footer.txt \
49 $(srcdir)/common-cmd-info-options.txt \
50 $(srcdir)/common-cmd-params-format.txt \
51 $(srcdir)/common-cmd-plugin-path.txt \
52 $(srcdir)/common-common-compat-env.txt \
53 $(srcdir)/common-ctf-plugin-env.txt \
54 $(srcdir)/common-footer.txt \
55 $(srcdir)/common-gen-options.txt \
56 $(srcdir)/common-lib-env.txt \
57 $(srcdir)/common-plugin-path-options.txt \
58 $(srcdir)/common-ppp-env.txt
61 ASCIIDOC_CONF = $(srcdir)/bt-asciidoc.conf
62 ASCIIDOC_ATTRS_CONF = $(builddir)/asciidoc-attrs.conf
63 XSL_SRC_FILE = $(srcdir)/manpage.xsl
66 COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
68 # man pages destinations
69 MAN1 = $(addsuffix .1,$(MAN1_NAMES))
70 MAN7 = $(addsuffix .7,$(MAN7_NAMES))
71 MAN1_NO_ASCIIDOC = $(addsuffix .1,$(MAN1_NO_ASCIIDOC_NAMES))
72 MAN7_NO_ASCIIDOC = $(addsuffix .7,$(MAN7_NO_ASCIIDOC_NAMES))
76 # at this point, we know the user asked to build the man pages
77 if HAVE_ASCIIDOC_XMLTO
78 asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
79 asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
80 asciidoc_verbose_0 = @echo " ASCIIDOC " $@;
81 xmlto_verbose = $(xmlto_verbose_@AM_V@)
82 xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
83 xmlto_verbose_0 = @echo " XMLTO " $@;
86 ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -f $(ASCIIDOC_ATTRS_CONF) -d manpage
87 ADOC_DOCBOOK = $(ADOC) -b docbook
88 XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_SRC_FILE) man
90 # only add this dependency if we can build the man pages because it's
91 # a file generated by the configure script, so it's more recent than
92 # the pregenerated man pages in a tarball
93 COMMON_DEPS += $(ASCIIDOC_ATTRS_CONF)
96 %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
97 $(ADOC_DOCBOOK) -o $@ $<
99 %.1: %.1.xml $(XSL_SRC_FILE)
100 $(XTO) $< 2>/dev/null
102 %.7.xml: $(srcdir)/%.7.txt $(COMMON_DEPS)
103 $(ADOC_DOCBOOK) -o $@ $<
105 %.7: %.7.xml $(XSL_SRC_FILE)
106 $(XTO) $< 2>/dev/null
108 # only clean the generated files if we have the tools to generate them again
109 CLEANFILES = $(MAN_XML) $(MAN)
110 else # HAVE_ASCIIDOC_XMLTO
111 # create man page targets used to stop the build if we want to
112 # build the man pages, but we don't have the necessary tools to do so
113 ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
114 ERR_MSG += "Make sure both tools are installed and run the configure script again."
116 %.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
120 %.7: $(srcdir)/%.7.txt $(COMMON_DEPS)
123 endif # HAVE_ASCIIDOC_XMLTO
124 endif # ENABLE_MAN_PAGES
126 # those are always installed since they are directly written in troff
127 dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
128 dist_man7_MANS = $(MAN7_NO_ASCIIDOC)
131 # building man pages: we can install and distribute them
132 dist_man1_MANS += $(MAN1)
133 dist_man7_MANS += $(MAN7)
134 endif # ENABLE_MAN_PAGES
138 @echo "Error: Please enable the man pages before creating a distribution tarball."
140 endif # !ENABLE_MAN_PAGES
142 # always distribute the source files
143 EXTRA_DIST = README.adoc $(MAN_TXT) $(COMMON_TXT) $(XSL_SRC_FILE) \
144 $(ASCIIDOC_CONF) $(ASCIIDOC_ATTRS_CONF).in