Fix: built-in plugins with new plugin filenames
[babeltrace.git] / cli / Makefile.am
CommitLineData
5a3ee633 1PLUGINS_PATH = $(abs_top_builddir)/plugins
c3ddb532
PP
2LTTNG_UTILS_PLUGIN_PATH =
3
4if ENABLE_DEBUG_INFO
5LTTNG_UTILS_PLUGIN_PATH += :$(PLUGINS_PATH)/lttng-utils
6endif
7
52238017
MJ
8if BABELTRACE_BUILD_WITH_MINGW
9IN_TREE_PLUGIN_PATH := $(shell cygpath -pm "$(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH)")
10else
c3ddb532 11IN_TREE_PLUGIN_PATH = $(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH)
52238017 12endif
c3ddb532 13
98ecef32 14AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include \
c3ddb532 15 '-DCONFIG_IN_TREE_PLUGIN_PATH="$(IN_TREE_PLUGIN_PATH)"'
a2029731 16AM_LDFLAGS = -lpopt
4c8bfb7e 17
899a1d74
PP
18bin_PROGRAMS = babeltrace.bin babeltrace-log.bin
19noinst_PROGRAMS = babeltrace babeltrace-log
4c8bfb7e 20
591999ca 21babeltrace_bin_SOURCES = \
c42c79ea
PP
22 babeltrace.c \
23 babeltrace-cfg.c \
c1870f57 24 babeltrace-cfg.h \
9009cc24
PP
25 babeltrace-cfg-cli-args.c \
26 babeltrace-cfg-cli-args.h \
27 babeltrace-cfg-cli-args-connect.c \
28 babeltrace-cfg-cli-args-connect.h \
29 babeltrace-cfg-cli-args-default.h \
7213a328 30 babeltrace-cfg-cli-args-default.c \
ea9f8b29 31 logging.c logging.h
847bf71a 32
e7c058b4
MD
33# -Wl,--no-as-needed is needed for recent gold linker who seems to think
34# it knows better and considers libraries with constructors having
30827463 35# side-effects as dead code.
f20cba2d 36babeltrace_bin_LDFLAGS = $(LD_NO_AS_NEEDED)
c3ddb532
PP
37
38# Add all the convenience libraries used by Babeltrace plugins and the
39# library. They will be used when embedding plugins (BUILT_IN_PLUGINS),
40# otherwise we're looking after multiple definitions of the same symbols if
41# a plugin's archive (.a) includes the convenience library because
42# we're using --whole-archive below (needed to make sure the linker does
43# not discard the plugins since the CLI does not use their symbols
44# directly).
591999ca 45babeltrace_bin_LDADD = \
6f3077a2 46 $(top_builddir)/lib/libbabeltrace.la \
9d1e7de0 47 $(top_builddir)/compat/libcompat.la \
7213a328 48 $(top_builddir)/common/libbabeltrace-common.la \
c3ddb532
PP
49 $(top_builddir)/logging/libbabeltrace-logging.la \
50 $(top_builddir)/plugins/libctfcopytrace/libctfcopytrace.la
1e3d1cee 51
cba174d5 52if BUILT_IN_PLUGINS
c3ddb532
PP
53# Takes a plugin name and outputs the needed LDFLAGS to embed it.
54#
55# The --whole-archive option is important here. From the GNU linker's
56# documentation:
57#
58# For each archive mentioned on the command line after the
59# --whole-archive option, include every object file in the archive in
60# the link, rather than searching the archive for the required object
61# files.
62#
63# In our case, we find the plugins thanks to special sections in the
64# binary that are filled by plugin objects. If the linker discards those
65# symbols because the CLI does not use them directly, the CLI reports
66# no plugins found (plugins are effectively not embedded).
63e5d159 67pluginarchive = -Wl,--whole-archive,$(PLUGINS_PATH)/$(1)/.libs/babeltrace-plugin-$(1).a,--no-whole-archive
c3ddb532
PP
68
69# Built-in plugins
70babeltrace_bin_LDFLAGS += $(call pluginarchive,ctf)
71babeltrace_bin_LDFLAGS += $(call pluginarchive,text)
72babeltrace_bin_LDFLAGS += $(call pluginarchive,utils)
73
74if ENABLE_DEBUG_INFO
75babeltrace_bin_LDFLAGS += $(call pluginarchive,lttng-utils)
76endif
cba174d5
JG
77endif
78
58819898 79if BABELTRACE_BUILD_WITH_MINGW
1cb3cdd7 80babeltrace_bin_LDADD += -lws2_32 -lrpcrt4 -lintl -liconv -lole32 -lpopt -lpthread
58819898 81endif
b545080b 82
c1870f57 83# Only used for in-tree execution and tests
9009cc24
PP
84babeltrace_SOURCES = $(babeltrace_bin_SOURCES)
85babeltrace_LDFLAGS = $(babeltrace_bin_LDFLAGS)
c1870f57
JG
86babeltrace_LDADD = $(babeltrace_bin_LDADD)
87babeltrace_CFLAGS = $(AM_CFLAGS) -DBT_SET_DEFAULT_IN_TREE_CONFIGURATION
899a1d74
PP
88
89# babeltrace-log rules and config below
90babeltrace_log_bin_SOURCES = babeltrace-log.c
91babeltrace_log_bin_LDADD = $(top_builddir)/compat/libcompat.la
92babeltrace_log_bin_CFLAGS = $(AM_CFLAGS) '-DBT_CLI_PATH="$(abs_top_builddir)/cli/babeltrace$(EXEEXT)"'
93
94if BABELTRACE_BUILD_WITH_MINGW
95babeltrace_log_bin_LDADD += -lpopt
96endif
97
98babeltrace_log_SOURCES = $(babeltrace_log_bin_SOURCES)
99babeltrace_log_LDADD = $(babeltrace_log_bin_LDADD)
100babeltrace_log_CFLAGS = $(AM_CFLAGS) '-DBT_CLI_PATH="$(bindir)/babeltrace$(EXEEXT)"'
This page took 0.04711 seconds and 4 git commands to generate.