1 PLUGINS_PATH = $(abs_top_builddir)/plugins
2 LTTNG_UTILS_PLUGIN_PATH =
5 LTTNG_UTILS_PLUGIN_PATH += :$(PLUGINS_PATH)/lttng-utils
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)")
11 IN_TREE_PLUGIN_PATH = $(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH)
14 AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include \
15 '-DCONFIG_IN_TREE_PLUGIN_PATH="$(IN_TREE_PLUGIN_PATH)"'
18 bin_PROGRAMS = babeltrace.bin
19 noinst_PROGRAMS = babeltrace
20 #check_PROGRAMS = babeltrace
22 babeltrace_bin_SOURCES = \
26 babeltrace-cfg-cli-args.c \
27 babeltrace-cfg-cli-args.h \
28 babeltrace-cfg-cli-args-connect.c \
29 babeltrace-cfg-cli-args-connect.h \
30 babeltrace-cfg-cli-args-default.h \
31 babeltrace-cfg-cli-args-default.c \
34 # -Wl,--no-as-needed is needed for recent gold linker who seems to think
35 # it knows better and considers libraries with constructors having
36 # side-effects as dead code.
37 babeltrace_bin_LDFLAGS = $(LD_NO_AS_NEEDED)
39 # Add all the convenience libraries used by Babeltrace plugins and the
40 # library. They will be used when embedding plugins (BUILT_IN_PLUGINS),
41 # otherwise we're looking after multiple definitions of the same symbols if
42 # a plugin's archive (.a) includes the convenience library because
43 # we're using --whole-archive below (needed to make sure the linker does
44 # not discard the plugins since the CLI does not use their symbols
46 babeltrace_bin_LDADD = \
47 $(top_builddir)/lib/libbabeltrace.la \
48 $(top_builddir)/compat/libcompat.la \
49 $(top_builddir)/common/libbabeltrace-common.la \
50 $(top_builddir)/logging/libbabeltrace-logging.la \
51 $(top_builddir)/plugins/libctfcopytrace/libctfcopytrace.la
54 # Takes a plugin name and outputs the needed LDFLAGS to embed it.
56 # The --whole-archive option is important here. From the GNU linker's
59 # For each archive mentioned on the command line after the
60 # --whole-archive option, include every object file in the archive in
61 # the link, rather than searching the archive for the required object
64 # In our case, we find the plugins thanks to special sections in the
65 # binary that are filled by plugin objects. If the linker discards those
66 # symbols because the CLI does not use them directly, the CLI reports
67 # no plugins found (plugins are effectively not embedded).
68 pluginarchive = -Wl,--whole-archive,$(PLUGINS_PATH)/$(1)/.libs/libbabeltrace-plugin-$(1).a,--no-whole-archive
71 babeltrace_bin_LDFLAGS += $(call pluginarchive,ctf)
72 babeltrace_bin_LDFLAGS += $(call pluginarchive,text)
73 babeltrace_bin_LDFLAGS += $(call pluginarchive,utils)
76 babeltrace_bin_LDFLAGS += $(call pluginarchive,lttng-utils)
80 if BABELTRACE_BUILD_WITH_MINGW
81 babeltrace_bin_LDADD += -lws2_32 -lrpcrt4 -lintl -liconv -lole32 -lpopt -lpthread
84 # Only used for in-tree execution and tests
85 babeltrace_SOURCES = $(babeltrace_bin_SOURCES)
86 babeltrace_LDFLAGS = $(babeltrace_bin_LDFLAGS)
87 babeltrace_LDADD = $(babeltrace_bin_LDADD)
88 babeltrace_CFLAGS = $(AM_CFLAGS) -DBT_SET_DEFAULT_IN_TREE_CONFIGURATION