File: Makefile.am

package info (click to toggle)
ust 2.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,444 kB
  • sloc: xml: 78,798; ansic: 48,233; sh: 5,806; java: 2,202; makefile: 1,832; python: 727; cpp: 384
file content (168 lines) | stat: -rw-r--r-- 5,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# SPDX-FileCopyrightText: 2023 EfficiOS, Inc
#
# SPDX-License-Identifier: LGPL-2.1-only

# Man pages are only built if they are enabled at configure time.
#
# They should always be built before creating a distribution tarball.

# Function which adds the source directory prefix and adds a given suffix:
manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))

# List only the names without the .*.txt extension here:
MAN1_NAMES = \
	lttng-gen-tp
MAN3_NAMES = \
	lttng-ust \
	lttng-ust-dl \
	lttng-ust-cyg-profile \
	lttng_ust_tracef \
	lttng_ust_tracelog \
	tracef \
	tracelog

# Man page aliases (generated from other sources):
MAN3_ALIASES = lttng_ust_vtracef.3 lttng_ust_vtracelog.3

# troff man pages:
MAN3_TROFF = \
	do_tracepoint.3 \
	lttng_ust_do_tracepoint.3 \
	lttng_ust_tracepoint.3 \
	lttng_ust_tracepoint_enabled.3 \
	tracepoint.3 \
	tracepoint_enabled.3

# AsciiDoc sources and outputs:
MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))

# Common AsciiDoc source files:
COMMON_TXT = \
	$(srcdir)/common-footer.txt \
	$(srcdir)/common-authors.txt \
	$(srcdir)/common-copyrights.txt \
	$(srcdir)/log-levels.txt \
	$(srcdir)/tracef-tracelog-limitations.txt

# AsciiDoc configuration and XSL files:
ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
XSL_FILE = $(srcdir)/manpage.xsl

# Common dependencies:
COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)

# Man pages destinations:
MAN1 = $(addsuffix .1,$(MAN1_NAMES))
MAN3 = $(addsuffix .3,$(MAN3_NAMES)) $(MAN3_ALIASES)
MAN = $(MAN1) $(MAN3)

if ENABLE_MAN_PAGES
# At this point, we know the user asked to build the man pages.
if HAVE_ASCIIDOC_XMLTO

asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
asciidoc_verbose_0 = @echo "  ASCIIDOC  " $@;

xmlto_verbose = $(xmlto_verbose_@AM_V@)
xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
xmlto_verbose_0 = @echo "  XMLTO     " $@;

xmlto_verbose_out = $(xmlto_verbose_out_@AM_V@)
xmlto_verbose_out_ = $(xmlto_verbose_out_@AM_DEFAULT_V@)
xmlto_verbose_out_0 = 2>/dev/null

v_flag := $(if $(filter 1,@AM_V@),-vv)

# Tools to execute:
ADOC = $(asciidoc_verbose)$(ASCIIDOC) $(v_flag) -f $(ASCIIDOC_CONF) -d manpage \
	-a mansource="LTTng" \
	-a manmanual="LTTng Manual" \
	-a manversion="$(PACKAGE_VERSION)" \
	-a lttng_version="$(LTTNG_UST_MAJOR_VERSION).$(LTTNG_UST_MINOR_VERSION)"

ADOC_DOCBOOK = $(ADOC) -b docbook
XTO = $(xmlto_verbose)$(XMLTO) $(v_flag) -m $(XSL_FILE) man

# Recipes:
%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
	$(ADOC_DOCBOOK) -o $@ $<

%.1: %.1.xml $(XSL_FILE)
	$(XTO) $< $(xmlto_verbose_out)

%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
	$(ADOC_DOCBOOK) -o $@ $<

# These pair of files are generated by a single invocation of xmlto, use
# an empty rule that depends on a fake intermediate file to track the
# dependencies without resorting to Group Targets which were only
# introduced in GNU Make 4.3.
lttng_ust_tracef.3 lttng_ust_vtracef.3: lttng_ust_tracef.3.alias
	@# Empty recipe to mark lttng_ust_tracef.3 and lttng_ust_vtracef.3 as rebuilt

lttng_ust_tracelog.3 lttng_ust_vtracelog.3: lttng_ust_tracelog.3.alias
	@# Empty recipe to mark lttng_ust_tracelog.3 and lttng_ust_vtracelog.3 as rebuilt


.INTERMEDIATE: tracef.3.alias tracelog.3.alias lttng_ust_tracef.3.alias lttng_ust_tracelog.3.alias

tracef.3.alias: tracef.3.xml $(XSL_FILE)
	$(XTO) $< $(xmlto_verbose_out)

tracelog.3.alias: tracelog.3.xml $(XSL_FILE)
	$(XTO) $< $(xmlto_verbose_out)

lttng_ust_tracef.3.alias: lttng_ust_tracef.3.xml $(XSL_FILE)
	$(XTO) $< $(xmlto_verbose_out)

lttng_ust_tracelog.3.alias: lttng_ust_tracelog.3.xml $(XSL_FILE)
	$(XTO) $< $(xmlto_verbose_out)

%.3: %.3.xml $(XSL_FILE)
	$(XTO) $< $(xmlto_verbose_out)

# Only clean the generated files if we have the tools to generate them again.
CLEANFILES = $(MAN_XML) $(MAN)
else # HAVE_ASCIIDOC_XMLTO
# Create man page targets used to stop the build if we want to
# build the man pages, but we don't have the necessary tools to do so.
ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
ERR_MSG += "Make sure both tools are installed and run the configure script again."

%.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
	@echo $(ERR_MSG)
	@false

%.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
	@echo $(ERR_MSG)
	@false
endif # HAVE_ASCIIDOC_XMLTO
endif # ENABLE_MAN_PAGES

# Start with empty distributed/installed man pages:
dist_man1_MANS =
dist_man3_MANS =
EXTRA_DIST =

if ENABLE_MAN_PAGES
# Building man pages: we can install and distribute them.
dist_man1_MANS += $(MAN1)
dist_man3_MANS += $(MAN3) $(MAN3_TROFF)
else # ENABLE_MAN_PAGES
# Those are not known by automake yet because dist_man3_MANS is empty
# at this point, so make sure they are distributed.
EXTRA_DIST += $(MAN3_TROFF)
endif # ENABLE_MAN_PAGES

if !ENABLE_MAN_PAGES
dist-hook:
	@echo "Error: Please enable the man pages before creating a distribution tarball."
	@false
endif # !ENABLE_MAN_PAGES

# Always distribute the source files.
EXTRA_DIST += $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) $(ASCIIDOC_CONF) README.md