doc/man: document LTTng-UST 2.13
[lttng-ust.git] / doc / man / Makefile.am
1 # SPDX-License-Identifier: LGPL-2.1-only
2
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:
8 manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
9
10 # List only the names without the .*.txt extension here:
11 MAN1_NAMES = \
12 lttng-gen-tp
13 MAN3_NAMES = \
14 lttng-ust \
15 lttng-ust-dl \
16 lttng-ust-cyg-profile \
17 lttng_ust_tracef \
18 lttng_ust_tracelog \
19 tracef \
20 tracelog
21
22 # Man page aliases (generated from other sources):
23 MAN3_ALIASES = lttng_ust_vtracef.3 lttng_ust_vtracelog.3 vtracef.3 vtracelog.3
24
25 # troff man pages:
26 MAN3_TROFF = \
27 do_tracepoint.3 \
28 lttng_ust_do_tracepoint.3 \
29 lttng_ust_tracepoint.3 \
30 lttng_ust_tracepoint_enabled.3 \
31 tracepoint.3 \
32 tracepoint_enabled.3
33
34 # AsciiDoc sources and outputs:
35 MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
36 MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
37 MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
38 MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
39
40 # Common AsciiDoc source files:
41 COMMON_TXT = \
42 $(srcdir)/common-footer.txt \
43 $(srcdir)/common-authors.txt \
44 $(srcdir)/common-copyrights.txt \
45 $(srcdir)/log-levels.txt \
46 $(srcdir)/tracef-tracelog-limitations.txt
47
48 # AsciiDoc configuration and XSL files:
49 ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
50 XSL_FILE = $(srcdir)/manpage.xsl
51
52 # Common dependencies:
53 COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
54
55 # Man pages destinations:
56 MAN1 = $(addsuffix .1,$(MAN1_NAMES))
57 MAN3 = $(addsuffix .3,$(MAN3_NAMES)) $(MAN3_ALIASES)
58 MAN = $(MAN1) $(MAN3)
59
60 if ENABLE_MAN_PAGES
61 # At this point, we know the user asked to build the man pages.
62 if HAVE_ASCIIDOC_XMLTO
63
64 asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
65 asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
66 asciidoc_verbose_0 = @echo " ASCIIDOC " $@;
67
68 xmlto_verbose = $(xmlto_verbose_@AM_V@)
69 xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
70 xmlto_verbose_0 = @echo " XMLTO " $@;
71
72 xmlto_verbose_out = $(xmlto_verbose_out_@AM_V@)
73 xmlto_verbose_out_ = $(xmlto_verbose_out_@AM_DEFAULT_V@)
74 xmlto_verbose_out_0 = 2>/dev/null
75
76 # Tools to execute:
77 ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
78 -a mansource="LTTng" \
79 -a manmanual="LTTng Manual" \
80 -a manversion="$(PACKAGE_VERSION)"
81
82 ADOC_DOCBOOK = $(ADOC) -b docbook
83 XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_FILE) man
84
85 # Recipes:
86 %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
87 $(ADOC_DOCBOOK) -o $@ $<
88
89 %.1: %.1.xml $(XSL_FILE)
90 $(XTO) $< $(xmlto_verbose_out)
91
92 %.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
93 $(ADOC_DOCBOOK) -o $@ $<
94
95 # These pair of files are generated by a single invocation of xmlto, use an
96 # empty rule that depends on a fake intermediate file to track the dependencies
97 # without resorting to Group Targets which were only introduced in GNU Make 4.3.
98 tracef.3 vtracef.3: tracef.3.alias
99 @# Empty recipe to mark tracef.3 and vtracef.3 as rebuilt
100
101 tracelog.3 vtracelog.3: tracelog.3.alias
102 @# Empty recipe to mark tracelog.3 and vtracelog.3 as rebuilt
103
104 lttng_ust_tracef.3 lttng_ust_vtracef.3: lttng_ust_tracef.3.alias
105 @# Empty recipe to mark lttng_ust_tracef.3 and lttng_ust_vtracef.3 as rebuilt
106
107 lttng_ust_tracelog.3 lttng_ust_vtracelog.3: lttng_ust_tracelog.3.alias
108 @# Empty recipe to mark lttng_ust_tracelog.3 and lttng_ust_vtracelog.3 as rebuilt
109
110
111 .INTERMEDIATE: tracef.3.alias tracelog.3.alias lttng_ust_tracef.3.alias lttng_ust_tracelog.3.alias
112
113 tracef.3.alias: tracef.3.xml $(XSL_FILE)
114 $(XTO) $< $(xmlto_verbose_out)
115
116 tracelog.3.alias: tracelog.3.xml $(XSL_FILE)
117 $(XTO) $< $(xmlto_verbose_out)
118
119 lttng_ust_tracef.3.alias: lttng_ust_tracef.3.xml $(XSL_FILE)
120 $(XTO) $< $(xmlto_verbose_out)
121
122 lttng_ust_tracelog.3.alias: lttng_ust_tracelog.3.xml $(XSL_FILE)
123 $(XTO) $< $(xmlto_verbose_out)
124
125 %.3: %.3.xml $(XSL_FILE)
126 $(XTO) $< $(xmlto_verbose_out)
127
128 # Only clean the generated files if we have the tools to generate them again.
129 CLEANFILES = $(MAN_XML) $(MAN)
130 else # HAVE_ASCIIDOC_XMLTO
131 # Create man page targets used to stop the build if we want to
132 # build the man pages, but we don't have the necessary tools to do so.
133 ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
134 ERR_MSG += "Make sure both tools are installed and run the configure script again."
135
136 %.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
137 @echo $(ERR_MSG)
138 @false
139
140 %.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
141 @echo $(ERR_MSG)
142 @false
143 endif # HAVE_ASCIIDOC_XMLTO
144 endif # ENABLE_MAN_PAGES
145
146 # Start with empty distributed/installed man pages:
147 dist_man1_MANS =
148 dist_man3_MANS =
149 EXTRA_DIST =
150
151 if ENABLE_MAN_PAGES
152 # Building man pages: we can install and distribute them.
153 dist_man1_MANS += $(MAN1)
154 dist_man3_MANS += $(MAN3) $(MAN3_TROFF)
155 else # ENABLE_MAN_PAGES
156 # Those are not known by automake yet because dist_man3_MANS is empty
157 # at this point, so make sure they are distributed.
158 EXTRA_DIST += $(MAN3_TROFF)
159 endif # ENABLE_MAN_PAGES
160
161 if !ENABLE_MAN_PAGES
162 dist-hook:
163 @echo "Error: Please enable the man pages before creating a distribution tarball."
164 @false
165 endif # !ENABLE_MAN_PAGES
166
167 # Always distribute the source files.
168 EXTRA_DIST += $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) $(ASCIIDOC_CONF) README.md
This page took 0.032875 seconds and 4 git commands to generate.