Make the in-tree CLI use the in-tree PPP
[babeltrace.git] / src / cli / Makefile.am
CommitLineData
578e048b 1PLUGINS_PATH = $(abs_top_builddir)/src/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
05c03100 14AM_CPPFLAGS += '-DCONFIG_IN_TREE_PLUGIN_PATH="$(IN_TREE_PLUGIN_PATH)"'
4c8bfb7e 15
afe821ca
MJ
16if ENABLE_PYTHON_PLUGINS
17AM_CPPFLAGS += '-DCONFIG_IN_TREE_PROVIDER_DIR="$(abs_top_builddir)/src/python-plugin-provider/.libs"'
18endif
19
ec2c5e50
MJ
20bin_PROGRAMS = babeltrace2.bin babeltrace2-log.bin
21noinst_PROGRAMS = babeltrace2 babeltrace2-log
4c8bfb7e 22
ec2c5e50
MJ
23babeltrace2_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 \
8bd04432
PP
33 babeltrace2-cfg-cli-params-arg.c \
34 babeltrace2-cfg-cli-params-arg.h \
ea9f8b29 35 logging.c logging.h
847bf71a 36
e7c058b4
MD
37# -Wl,--no-as-needed is needed for recent gold linker who seems to think
38# it knows better and considers libraries with constructors having
30827463 39# side-effects as dead code.
ec2c5e50 40babeltrace2_bin_LDFLAGS = $(LD_NO_AS_NEEDED)
c3ddb532
PP
41
42# Add all the convenience libraries used by Babeltrace plugins and the
9ffc0257 43# library. They will be used when embedding plugins (--enable-built-in-plugins),
c3ddb532
PP
44# otherwise we're looking after multiple definitions of the same symbols if
45# a plugin's archive (.a) includes the convenience library because
46# we're using --whole-archive below (needed to make sure the linker does
47# not discard the plugins since the CLI does not use their symbols
48# directly).
ec2c5e50 49babeltrace2_bin_LDADD = \
578e048b
MJ
50 $(top_builddir)/src/lib/libbabeltrace2.la \
51 $(top_builddir)/src/compat/libcompat.la \
52 $(top_builddir)/src/common/libbabeltrace2-common.la \
53 $(top_builddir)/src/logging/libbabeltrace2-logging.la \
4e87f509 54 $(top_builddir)/src/ctfser/libbabeltrace2-ctfser.la \
4817cd5b 55 $(POPT_LIBS)
1e3d1cee 56
9ffc0257 57if ENABLE_BUILT_IN_PLUGINS
c3ddb532
PP
58# Takes a plugin name and outputs the needed LDFLAGS to embed it.
59#
60# The --whole-archive option is important here. From the GNU linker's
61# documentation:
62#
63# For each archive mentioned on the command line after the
64# --whole-archive option, include every object file in the archive in
65# the link, rather than searching the archive for the required object
66# files.
67#
68# In our case, we find the plugins thanks to special sections in the
69# binary that are filled by plugin objects. If the linker discards those
70# symbols because the CLI does not use them directly, the CLI reports
71# no plugins found (plugins are effectively not embedded).
1244e794 72pluginarchive = $(LD_WHOLE_ARCHIVE)$(PLUGINS_PATH)/$(1)/.libs/babeltrace-plugin-$(1).a$(LD_NO_WHOLE_ARCHIVE)
c3ddb532
PP
73
74# Built-in plugins
ec2c5e50
MJ
75babeltrace2_bin_LDFLAGS += $(call pluginarchive,ctf)
76babeltrace2_bin_LDFLAGS += $(call pluginarchive,text)
77babeltrace2_bin_LDFLAGS += $(call pluginarchive,utils)
c3ddb532
PP
78
79if ENABLE_DEBUG_INFO
ec2c5e50
MJ
80babeltrace2_bin_LDFLAGS += $(call pluginarchive,lttng-utils)
81babeltrace2_bin_LDADD += $(ELFUTILS_LIBS)
c3ddb532 82endif
cba174d5
JG
83endif
84
58819898 85if BABELTRACE_BUILD_WITH_MINGW
ec2c5e50 86babeltrace2_bin_LDADD += -lws2_32 -lrpcrt4 -lintl -liconv -lole32 -lpthread
58819898 87endif
b545080b 88
c1870f57 89# Only used for in-tree execution and tests
ec2c5e50
MJ
90babeltrace2_SOURCES = $(babeltrace2_bin_SOURCES)
91babeltrace2_LDFLAGS = $(babeltrace2_bin_LDFLAGS)
92babeltrace2_LDADD = $(babeltrace2_bin_LDADD)
93babeltrace2_CFLAGS = $(AM_CFLAGS) -DBT_SET_DEFAULT_IN_TREE_CONFIGURATION
899a1d74 94
ec2c5e50
MJ
95# babeltrace2-log rules and config below
96babeltrace2_log_bin_SOURCES = babeltrace2-log.c
97babeltrace2_log_bin_LDADD = \
578e048b
MJ
98 $(top_builddir)/src/compat/libcompat.la \
99 $(top_builddir)/src/common/libbabeltrace2-common.la \
100 $(top_builddir)/src/logging/libbabeltrace2-logging.la \
4817cd5b 101 $(POPT_LIBS)
578e048b 102babeltrace2_log_bin_CFLAGS = $(AM_CFLAGS) '-DBT_CLI_PATH="$(abs_top_builddir)/src/cli/babeltrace2$(EXEEXT)"'
899a1d74 103
4817cd5b 104# Only used for in-tree execution and tests
ec2c5e50
MJ
105babeltrace2_log_SOURCES = $(babeltrace2_log_bin_SOURCES)
106babeltrace2_log_LDADD = $(babeltrace2_log_bin_LDADD)
107babeltrace2_log_CFLAGS = $(AM_CFLAGS) '-DBT_CLI_PATH="$(bindir)/babeltrace2$(EXEEXT)"'
This page took 0.068374 seconds and 4 git commands to generate.