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