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