Add --enable-asan configure option
[babeltrace.git] / src / cli / Makefile.am
... / ...
CommitLineData
1# SPDX-License-Identifier: MIT
2
3PLUGINS_PATH = $(abs_top_builddir)/src/plugins
4LTTNG_UTILS_PLUGIN_PATH =
5
6if ENABLE_DEBUG_INFO
7LTTNG_UTILS_PLUGIN_PATH += :$(PLUGINS_PATH)/lttng-utils
8endif
9
10if BABELTRACE_BUILD_WITH_MINGW
11IN_TREE_PLUGIN_PATH := $(shell cygpath -pm "$(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH)")
12else
13IN_TREE_PLUGIN_PATH = $(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH)
14endif
15
16AM_CPPFLAGS += '-DCONFIG_IN_TREE_PLUGIN_PATH="$(IN_TREE_PLUGIN_PATH)"'
17
18if ENABLE_PYTHON_PLUGINS
19AM_CPPFLAGS += '-DCONFIG_IN_TREE_PROVIDER_DIR="$(abs_top_builddir)/src/python-plugin-provider/.libs"'
20endif
21
22bin_PROGRAMS = babeltrace2.bin
23noinst_PROGRAMS = babeltrace2
24
25babeltrace2_bin_SOURCES = \
26 babeltrace2.c \
27 babeltrace2-cfg.c \
28 babeltrace2-cfg.h \
29 babeltrace2-cfg-cli-args.c \
30 babeltrace2-cfg-cli-args.h \
31 babeltrace2-cfg-cli-args-connect.c \
32 babeltrace2-cfg-cli-args-connect.h \
33 babeltrace2-cfg-cli-args-default.h \
34 babeltrace2-cfg-cli-args-default.c \
35 babeltrace2-log-level.c \
36 babeltrace2-log-level.h \
37 babeltrace2-plugins.c \
38 babeltrace2-plugins.h \
39 babeltrace2-query.c \
40 babeltrace2-query.h \
41 logging.c \
42 logging.h
43
44# -Wl,--no-as-needed is needed for recent gold linker who seems to think
45# it knows better and considers libraries with constructors having
46# side-effects as dead code.
47babeltrace2_bin_LDFLAGS = $(AM_LDFLAGS) $(LD_NO_AS_NEEDED)
48
49# Add all the convenience libraries used by Babeltrace plugins and the
50# library. They will be used when embedding plugins (--enable-built-in-plugins),
51# otherwise we're looking after multiple definitions of the same symbols if
52# a plugin's archive (.a) includes the convenience library because
53# we're using --whole-archive below (needed to make sure the linker does
54# not discard the plugins since the CLI does not use their symbols
55# directly).
56babeltrace2_bin_LDADD = \
57 $(top_builddir)/src/argpar/libargpar.la \
58 $(top_builddir)/src/autodisc/libbabeltrace2-autodisc.la \
59 $(top_builddir)/src/param-parse/libbabeltrace2-param-parse.la \
60 $(top_builddir)/src/string-format/libbabeltrace2-string-format.la \
61 $(top_builddir)/src/lib/libbabeltrace2.la \
62 $(top_builddir)/src/compat/libcompat.la \
63 $(top_builddir)/src/common/libbabeltrace2-common.la \
64 $(top_builddir)/src/logging/libbabeltrace2-logging.la \
65 $(top_builddir)/src/ctfser/libbabeltrace2-ctfser.la
66
67if ENABLE_BUILT_IN_PLUGINS
68# Takes a plugin name and outputs the needed LDFLAGS to embed it.
69#
70# The --whole-archive option is important here. From the GNU linker's
71# documentation:
72#
73# For each archive mentioned on the command line after the
74# --whole-archive option, include every object file in the archive in
75# the link, rather than searching the archive for the required object
76# files.
77#
78# In our case, we find the plugins thanks to special sections in the
79# binary that are filled by plugin objects. If the linker discards those
80# symbols because the CLI does not use them directly, the CLI reports
81# no plugins found (plugins are effectively not embedded).
82pluginarchive = $(LD_WHOLE_ARCHIVE)$(PLUGINS_PATH)/$(1)/.libs/babeltrace-plugin-$(1).a$(LD_NO_WHOLE_ARCHIVE)
83
84# Built-in plugins
85babeltrace2_bin_LDFLAGS += $(call pluginarchive,ctf)
86babeltrace2_bin_LDFLAGS += $(call pluginarchive,text)
87babeltrace2_bin_LDFLAGS += $(call pluginarchive,utils)
88
89if ENABLE_DEBUG_INFO
90babeltrace2_bin_LDFLAGS += $(call pluginarchive,lttng-utils)
91babeltrace2_bin_LDADD += $(ELFUTILS_LIBS)
92endif
93endif
94
95if BABELTRACE_BUILD_WITH_MINGW
96babeltrace2_bin_LDADD += -lws2_32 -lrpcrt4 -lintl -liconv -lole32 -lpthread
97endif
98
99# Only used for in-tree execution and tests
100babeltrace2_SOURCES = $(babeltrace2_bin_SOURCES)
101babeltrace2_LDFLAGS = $(babeltrace2_bin_LDFLAGS)
102babeltrace2_LDADD = $(babeltrace2_bin_LDADD)
103babeltrace2_CFLAGS = $(AM_CFLAGS) -DBT_SET_DEFAULT_IN_TREE_CONFIGURATION
This page took 0.023084 seconds and 4 git commands to generate.