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