Move to kernel style SPDX license identifiers
[lttng-ust.git] / doc / man / Makefile.am
CommitLineData
c0c0989a
MJ
1# SPDX-License-Identifier: LGPL-2.1-only
2
4ddbd0b7
PP
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:
8manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
9
10# List only the names without the .*.txt extension here:
11MAN1_NAMES = \
12 lttng-gen-tp
13MAN3_NAMES = \
14 lttng-ust \
15 tracef \
16 tracelog \
17 lttng-ust-dl \
18 lttng-ust-cyg-profile
19
20# troff man pages:
21MAN3_TROFF = do_tracepoint.3 tracepoint.3 tracepoint_enabled.3
22
23# AsciiDoc sources and outputs:
24MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
25MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
26MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
27MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
28
29# Common AsciiDoc source files:
30COMMON_TXT = \
31 $(srcdir)/common-footer.txt \
32 $(srcdir)/common-authors.txt \
33 $(srcdir)/common-copyrights.txt \
34 $(srcdir)/log-levels.txt \
35 $(srcdir)/tracef-tracelog-limitations.txt
36
37# AsciiDoc configuration and XSL files:
38ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
6bf962a4 39XSL_FILE = $(srcdir)/manpage.xsl
4ddbd0b7
PP
40
41# Common dependencies:
42COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
43
44# Man pages destinations:
45MAN1 = $(addsuffix .1,$(MAN1_NAMES))
46MAN3 = $(addsuffix .3,$(MAN3_NAMES))
47MAN = $(MAN1) $(MAN3)
48
49if MAN_PAGES_OPT
50# At this point, we know the user asked to build the man pages.
51if HAVE_ASCIIDOC_XMLTO
e02d8dc3
MJ
52
53asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
54asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
55asciidoc_verbose_0 = @echo " ASCIIDOC " $@;
56
57xmlto_verbose = $(xmlto_verbose_@AM_V@)
58xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
59xmlto_verbose_0 = @echo " XMLTO " $@;
60
4ddbd0b7 61# Tools to execute:
e02d8dc3 62ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
82f9bfc0
SM
63 -a lttng_ust_register_timeout="@LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS@" \
64 -a mansource="LTTng" \
65 -a manmanual="LTTng Manual" \
66 -a manversion="$(PACKAGE_VERSION)"
6f97f9c2 67
4ddbd0b7 68ADOC_DOCBOOK = $(ADOC) -b docbook
e02d8dc3 69XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_FILE) man
4ddbd0b7
PP
70
71# Recipes:
72%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
73 $(ADOC_DOCBOOK) -o $@ $<
74
6bf962a4 75%.1: %.1.xml $(XSL_FILE)
e02d8dc3 76 $(XTO) $< 2>/dev/null
4ddbd0b7
PP
77
78%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
79 $(ADOC_DOCBOOK) -o $@ $<
80
6bf962a4 81%.3: %.3.xml $(XSL_FILE)
e02d8dc3 82 $(XTO) $< 2>/dev/null
4ddbd0b7
PP
83
84# Only clean the generated files if we have the tools to generate them again.
85CLEANFILES = $(MAN_XML) $(MAN)
86else # HAVE_ASCIIDOC_XMLTO
87# Create man page targets used to stop the build if we want to
88# build the man pages, but we don't have the necessary tools to do so.
89ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
90ERR_MSG += "Make sure both tools are installed and run the configure script again."
91
92%.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
93 @echo $(ERR_MSG)
94 @false
95
96%.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
97 @echo $(ERR_MSG)
98 @false
99endif # HAVE_ASCIIDOC_XMLTO
100endif # MAN_PAGES_OPT
101
102# Start with empty distributed/installed man pages:
103dist_man1_MANS =
104dist_man3_MANS =
105EXTRA_DIST =
106
107if MAN_PAGES_OPT
108# Building man pages: we can install and distribute them.
109dist_man1_MANS += $(MAN1)
110dist_man3_MANS += $(MAN3) $(MAN3_TROFF)
111else # MAN_PAGES_OPT
112# Those are not known by automake yet because dist_man3_MANS is empty
113# at this point, so make sure they are distributed.
114EXTRA_DIST += $(MAN3_TROFF)
115endif # MAN_PAGES_OPT
116
117if !MAN_PAGES_OPT
118dist-hook:
119 @echo "Error: Please enable the man pages before creating a distribution tarball."
120 @false
121endif # !MAN_PAGES_OPT
122
123# Always distribute the source files.
e6e508c9 124EXTRA_DIST += $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) $(ASCIIDOC_CONF) README.md
This page took 0.028331 seconds and 4 git commands to generate.