Commit | Line | Data |
---|---|---|
0235b0db MJ |
1 | # SPDX-License-Identifier: MIT |
2 | ||
578e048b | 3 | PLUGINS_PATH = $(abs_top_builddir)/src/plugins |
c3ddb532 PP |
4 | LTTNG_UTILS_PLUGIN_PATH = |
5 | ||
6 | if ENABLE_DEBUG_INFO | |
7 | LTTNG_UTILS_PLUGIN_PATH += :$(PLUGINS_PATH)/lttng-utils | |
8 | endif | |
9 | ||
52238017 MJ |
10 | if BABELTRACE_BUILD_WITH_MINGW |
11 | IN_TREE_PLUGIN_PATH := $(shell cygpath -pm "$(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH)") | |
12 | else | |
c3ddb532 | 13 | IN_TREE_PLUGIN_PATH = $(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH) |
52238017 | 14 | endif |
c3ddb532 | 15 | |
05c03100 | 16 | AM_CPPFLAGS += '-DCONFIG_IN_TREE_PLUGIN_PATH="$(IN_TREE_PLUGIN_PATH)"' |
4c8bfb7e | 17 | |
afe821ca MJ |
18 | if ENABLE_PYTHON_PLUGINS |
19 | AM_CPPFLAGS += '-DCONFIG_IN_TREE_PROVIDER_DIR="$(abs_top_builddir)/src/python-plugin-provider/.libs"' | |
20 | endif | |
21 | ||
bb30da78 SM |
22 | bin_PROGRAMS = babeltrace2.bin |
23 | noinst_PROGRAMS = babeltrace2 | |
4c8bfb7e | 24 | |
ec2c5e50 MJ |
25 | babeltrace2_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 \ | |
ebddaeb8 SM |
35 | babeltrace2-log-level.c \ |
36 | babeltrace2-log-level.h \ | |
743138a3 SM |
37 | babeltrace2-plugins.c \ |
38 | babeltrace2-plugins.h \ | |
3c729b9a PP |
39 | babeltrace2-query.c \ |
40 | babeltrace2-query.h \ | |
bc7b4a4f | 41 | logging.cpp \ |
743138a3 | 42 | logging.h |
847bf71a | 43 | |
e7c058b4 MD |
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 | |
30827463 | 46 | # side-effects as dead code. |
0b0893d4 | 47 | babeltrace2_bin_LDFLAGS = $(AM_LDFLAGS) $(LD_NO_AS_NEEDED) |
c3ddb532 | 48 | |
53a47a3f MJ |
49 | EXTRA_babeltrace2_bin_DEPENDENCIES = |
50 | ||
c3ddb532 | 51 | # Add all the convenience libraries used by Babeltrace plugins and the |
9ffc0257 | 52 | # library. They will be used when embedding plugins (--enable-built-in-plugins), |
c3ddb532 PP |
53 | # otherwise we're looking after multiple definitions of the same symbols if |
54 | # a plugin's archive (.a) includes the convenience library because | |
55 | # we're using --whole-archive below (needed to make sure the linker does | |
56 | # not discard the plugins since the CLI does not use their symbols | |
57 | # directly). | |
ec2c5e50 | 58 | babeltrace2_bin_LDADD = \ |
65966041 | 59 | $(top_builddir)/src/argpar/libargpar.la \ |
97010665 | 60 | $(top_builddir)/src/autodisc/libbabeltrace2-autodisc.la \ |
3725ce94 | 61 | $(top_builddir)/src/param-parse/libbabeltrace2-param-parse.la \ |
ec532b44 | 62 | $(top_builddir)/src/string-format/libbabeltrace2-string-format.la \ |
578e048b MJ |
63 | $(top_builddir)/src/lib/libbabeltrace2.la \ |
64 | $(top_builddir)/src/compat/libcompat.la \ | |
65 | $(top_builddir)/src/common/libbabeltrace2-common.la \ | |
66 | $(top_builddir)/src/logging/libbabeltrace2-logging.la \ | |
3725ce94 | 67 | $(top_builddir)/src/ctfser/libbabeltrace2-ctfser.la |
1e3d1cee | 68 | |
9ffc0257 | 69 | if ENABLE_BUILT_IN_PLUGINS |
c3ddb532 PP |
70 | # Takes a plugin name and outputs the needed LDFLAGS to embed it. |
71 | # | |
72 | # The --whole-archive option is important here. From the GNU linker's | |
73 | # documentation: | |
74 | # | |
75 | # For each archive mentioned on the command line after the | |
76 | # --whole-archive option, include every object file in the archive in | |
77 | # the link, rather than searching the archive for the required object | |
78 | # files. | |
79 | # | |
80 | # In our case, we find the plugins thanks to special sections in the | |
81 | # binary that are filled by plugin objects. If the linker discards those | |
82 | # symbols because the CLI does not use them directly, the CLI reports | |
83 | # no plugins found (plugins are effectively not embedded). | |
1244e794 | 84 | pluginarchive = $(LD_WHOLE_ARCHIVE)$(PLUGINS_PATH)/$(1)/.libs/babeltrace-plugin-$(1).a$(LD_NO_WHOLE_ARCHIVE) |
c3ddb532 PP |
85 | |
86 | # Built-in plugins | |
ec2c5e50 MJ |
87 | babeltrace2_bin_LDFLAGS += $(call pluginarchive,ctf) |
88 | babeltrace2_bin_LDFLAGS += $(call pluginarchive,text) | |
89 | babeltrace2_bin_LDFLAGS += $(call pluginarchive,utils) | |
c3ddb532 | 90 | |
53a47a3f MJ |
91 | EXTRA_babeltrace2_bin_DEPENDENCIES += \ |
92 | $(PLUGINS_PATH)/ctf/babeltrace-plugin-ctf.la \ | |
93 | $(PLUGINS_PATH)/text/babeltrace-plugin-text.la \ | |
94 | $(PLUGINS_PATH)/utils/babeltrace-plugin-utils.la | |
95 | ||
c3ddb532 | 96 | if ENABLE_DEBUG_INFO |
ec2c5e50 MJ |
97 | babeltrace2_bin_LDFLAGS += $(call pluginarchive,lttng-utils) |
98 | babeltrace2_bin_LDADD += $(ELFUTILS_LIBS) | |
53a47a3f MJ |
99 | |
100 | EXTRA_babeltrace2_bin_DEPENDENCIES += \ | |
101 | $(PLUGINS_PATH)/lttng-utils/babeltrace-plugin-lttng-utils.la | |
c3ddb532 | 102 | endif |
cba174d5 JG |
103 | endif |
104 | ||
58819898 | 105 | if BABELTRACE_BUILD_WITH_MINGW |
ec2c5e50 | 106 | babeltrace2_bin_LDADD += -lws2_32 -lrpcrt4 -lintl -liconv -lole32 -lpthread |
58819898 | 107 | endif |
b545080b | 108 | |
c1870f57 | 109 | # Only used for in-tree execution and tests |
ec2c5e50 MJ |
110 | babeltrace2_SOURCES = $(babeltrace2_bin_SOURCES) |
111 | babeltrace2_LDFLAGS = $(babeltrace2_bin_LDFLAGS) | |
112 | babeltrace2_LDADD = $(babeltrace2_bin_LDADD) | |
113 | babeltrace2_CFLAGS = $(AM_CFLAGS) -DBT_SET_DEFAULT_IN_TREE_CONFIGURATION | |
53a47a3f | 114 | EXTRA_babeltrace2_DEPENDENCIES = $(EXTRA_babeltrace2_bin_DEPENDENCIES) |