Commit | Line | Data |
---|---|---|
57952005 | 1 | PLUGINS_PATH = $(abs_top_builddir)/src/plugins |
c3ddb532 PP |
2 | LTTNG_UTILS_PLUGIN_PATH = |
3 | ||
4 | if ENABLE_DEBUG_INFO | |
5 | LTTNG_UTILS_PLUGIN_PATH += :$(PLUGINS_PATH)/lttng-utils | |
6 | endif | |
7 | ||
be3c4e36 MJ |
8 | if BABELTRACE_BUILD_WITH_MINGW |
9 | IN_TREE_PLUGIN_PATH := $(shell cygpath -pm "$(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH)") | |
10 | else | |
c3ddb532 | 11 | IN_TREE_PLUGIN_PATH = $(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH) |
be3c4e36 | 12 | endif |
c3ddb532 | 13 | |
989e97b6 | 14 | AM_CPPFLAGS += '-DCONFIG_IN_TREE_PLUGIN_PATH="$(IN_TREE_PLUGIN_PATH)"' |
4c8bfb7e | 15 | |
58bb04cb MJ |
16 | if ENABLE_PYTHON_PLUGINS |
17 | AM_CPPFLAGS += '-DCONFIG_IN_TREE_PROVIDER_DIR="$(abs_top_builddir)/src/python-plugin-provider/.libs"' | |
18 | endif | |
19 | ||
142ac9b0 MJ |
20 | bin_PROGRAMS = babeltrace2.bin babeltrace2-log.bin |
21 | noinst_PROGRAMS = babeltrace2 babeltrace2-log | |
4c8bfb7e | 22 | |
142ac9b0 MJ |
23 | babeltrace2_bin_SOURCES = \ |
24 | babeltrace2.c \ | |
25 | babeltrace2-cfg.c \ | |
26 | babeltrace2-cfg.h \ | |
27 | babeltrace2-cfg-cli-args.c \ | |
28 | babeltrace2-cfg-cli-args.h \ | |
29 | babeltrace2-cfg-cli-args-connect.c \ | |
30 | babeltrace2-cfg-cli-args-connect.h \ | |
31 | babeltrace2-cfg-cli-args-default.h \ | |
32 | babeltrace2-cfg-cli-args-default.c \ | |
87c4d6ca PP |
33 | babeltrace2-cfg-cli-params-arg.c \ |
34 | babeltrace2-cfg-cli-params-arg.h \ | |
a1040187 SM |
35 | babeltrace2-cfg-src-auto-disc.c \ |
36 | babeltrace2-cfg-src-auto-disc.h \ | |
2e72e107 SM |
37 | babeltrace2-plugins.c \ |
38 | babeltrace2-plugins.h \ | |
bf403eb2 PP |
39 | babeltrace2-query.c \ |
40 | babeltrace2-query.h \ | |
2e72e107 SM |
41 | logging.c \ |
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. |
142ac9b0 | 47 | babeltrace2_bin_LDFLAGS = $(LD_NO_AS_NEEDED) |
c3ddb532 PP |
48 | |
49 | # Add all the convenience libraries used by Babeltrace plugins and the | |
de8bce8a | 50 | # library. They will be used when embedding plugins (--enable-built-in-plugins), |
c3ddb532 PP |
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). | |
142ac9b0 | 56 | babeltrace2_bin_LDADD = \ |
57952005 MJ |
57 | $(top_builddir)/src/lib/libbabeltrace2.la \ |
58 | $(top_builddir)/src/compat/libcompat.la \ | |
59 | $(top_builddir)/src/common/libbabeltrace2-common.la \ | |
60 | $(top_builddir)/src/logging/libbabeltrace2-logging.la \ | |
5586bb37 | 61 | $(top_builddir)/src/ctfser/libbabeltrace2-ctfser.la \ |
5cddb897 | 62 | $(POPT_LIBS) |
1e3d1cee | 63 | |
de8bce8a | 64 | if ENABLE_BUILT_IN_PLUGINS |
c3ddb532 PP |
65 | # Takes a plugin name and outputs the needed LDFLAGS to embed it. |
66 | # | |
67 | # The --whole-archive option is important here. From the GNU linker's | |
68 | # documentation: | |
69 | # | |
70 | # For each archive mentioned on the command line after the | |
71 | # --whole-archive option, include every object file in the archive in | |
72 | # the link, rather than searching the archive for the required object | |
73 | # files. | |
74 | # | |
75 | # In our case, we find the plugins thanks to special sections in the | |
76 | # binary that are filled by plugin objects. If the linker discards those | |
77 | # symbols because the CLI does not use them directly, the CLI reports | |
78 | # no plugins found (plugins are effectively not embedded). | |
11cc4f3d | 79 | pluginarchive = $(LD_WHOLE_ARCHIVE)$(PLUGINS_PATH)/$(1)/.libs/babeltrace-plugin-$(1).a$(LD_NO_WHOLE_ARCHIVE) |
c3ddb532 PP |
80 | |
81 | # Built-in plugins | |
142ac9b0 MJ |
82 | babeltrace2_bin_LDFLAGS += $(call pluginarchive,ctf) |
83 | babeltrace2_bin_LDFLAGS += $(call pluginarchive,text) | |
84 | babeltrace2_bin_LDFLAGS += $(call pluginarchive,utils) | |
c3ddb532 PP |
85 | |
86 | if ENABLE_DEBUG_INFO | |
142ac9b0 MJ |
87 | babeltrace2_bin_LDFLAGS += $(call pluginarchive,lttng-utils) |
88 | babeltrace2_bin_LDADD += $(ELFUTILS_LIBS) | |
c3ddb532 | 89 | endif |
cba174d5 JG |
90 | endif |
91 | ||
58819898 | 92 | if BABELTRACE_BUILD_WITH_MINGW |
142ac9b0 | 93 | babeltrace2_bin_LDADD += -lws2_32 -lrpcrt4 -lintl -liconv -lole32 -lpthread |
58819898 | 94 | endif |
b545080b | 95 | |
c1870f57 | 96 | # Only used for in-tree execution and tests |
142ac9b0 MJ |
97 | babeltrace2_SOURCES = $(babeltrace2_bin_SOURCES) |
98 | babeltrace2_LDFLAGS = $(babeltrace2_bin_LDFLAGS) | |
99 | babeltrace2_LDADD = $(babeltrace2_bin_LDADD) | |
100 | babeltrace2_CFLAGS = $(AM_CFLAGS) -DBT_SET_DEFAULT_IN_TREE_CONFIGURATION | |
5781a924 | 101 | |
142ac9b0 MJ |
102 | # babeltrace2-log rules and config below |
103 | babeltrace2_log_bin_SOURCES = babeltrace2-log.c | |
104 | babeltrace2_log_bin_LDADD = \ | |
57952005 MJ |
105 | $(top_builddir)/src/compat/libcompat.la \ |
106 | $(top_builddir)/src/common/libbabeltrace2-common.la \ | |
107 | $(top_builddir)/src/logging/libbabeltrace2-logging.la \ | |
5cddb897 | 108 | $(POPT_LIBS) |
57952005 | 109 | babeltrace2_log_bin_CFLAGS = $(AM_CFLAGS) '-DBT_CLI_PATH="$(abs_top_builddir)/src/cli/babeltrace2$(EXEEXT)"' |
5781a924 | 110 | |
5cddb897 | 111 | # Only used for in-tree execution and tests |
142ac9b0 MJ |
112 | babeltrace2_log_SOURCES = $(babeltrace2_log_bin_SOURCES) |
113 | babeltrace2_log_LDADD = $(babeltrace2_log_bin_LDADD) | |
114 | babeltrace2_log_CFLAGS = $(AM_CFLAGS) '-DBT_CLI_PATH="$(bindir)/babeltrace2$(EXEEXT)"' |