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