cli: move `--params` option's format parsing to its own file
[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 bin_PROGRAMS = babeltrace2.bin babeltrace2-log.bin
17 noinst_PROGRAMS = babeltrace2 babeltrace2-log
18
19 babeltrace2_bin_SOURCES = \
20 babeltrace2.c \
21 babeltrace2-cfg.c \
22 babeltrace2-cfg.h \
23 babeltrace2-cfg-cli-args.c \
24 babeltrace2-cfg-cli-args.h \
25 babeltrace2-cfg-cli-args-connect.c \
26 babeltrace2-cfg-cli-args-connect.h \
27 babeltrace2-cfg-cli-args-default.h \
28 babeltrace2-cfg-cli-args-default.c \
29 babeltrace2-cfg-cli-params-arg.c \
30 babeltrace2-cfg-cli-params-arg.h \
31 logging.c logging.h
32
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
35 # side-effects as dead code.
36 babeltrace2_bin_LDFLAGS = $(LD_NO_AS_NEEDED)
37
38 # Add all the convenience libraries used by Babeltrace plugins and the
39 # library. They will be used when embedding plugins (--enable-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).
45 babeltrace2_bin_LDADD = \
46 $(top_builddir)/src/lib/libbabeltrace2.la \
47 $(top_builddir)/src/compat/libcompat.la \
48 $(top_builddir)/src/common/libbabeltrace2-common.la \
49 $(top_builddir)/src/logging/libbabeltrace2-logging.la \
50 $(top_builddir)/src/ctfser/libbabeltrace2-ctfser.la \
51 $(POPT_LIBS)
52
53 if ENABLE_BUILT_IN_PLUGINS
54 # Takes a plugin name and outputs the needed LDFLAGS to embed it.
55 #
56 # The --whole-archive option is important here. From the GNU linker's
57 # documentation:
58 #
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
62 # files.
63 #
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 = $(LD_WHOLE_ARCHIVE)$(PLUGINS_PATH)/$(1)/.libs/babeltrace-plugin-$(1).a$(LD_NO_WHOLE_ARCHIVE)
69
70 # Built-in plugins
71 babeltrace2_bin_LDFLAGS += $(call pluginarchive,ctf)
72 babeltrace2_bin_LDFLAGS += $(call pluginarchive,text)
73 babeltrace2_bin_LDFLAGS += $(call pluginarchive,utils)
74
75 if ENABLE_DEBUG_INFO
76 babeltrace2_bin_LDFLAGS += $(call pluginarchive,lttng-utils)
77 babeltrace2_bin_LDADD += $(ELFUTILS_LIBS)
78 endif
79 endif
80
81 if BABELTRACE_BUILD_WITH_MINGW
82 babeltrace2_bin_LDADD += -lws2_32 -lrpcrt4 -lintl -liconv -lole32 -lpthread
83 endif
84
85 # Only used for in-tree execution and tests
86 babeltrace2_SOURCES = $(babeltrace2_bin_SOURCES)
87 babeltrace2_LDFLAGS = $(babeltrace2_bin_LDFLAGS)
88 babeltrace2_LDADD = $(babeltrace2_bin_LDADD)
89 babeltrace2_CFLAGS = $(AM_CFLAGS) -DBT_SET_DEFAULT_IN_TREE_CONFIGURATION
90
91 # babeltrace2-log rules and config below
92 babeltrace2_log_bin_SOURCES = babeltrace2-log.c
93 babeltrace2_log_bin_LDADD = \
94 $(top_builddir)/src/compat/libcompat.la \
95 $(top_builddir)/src/common/libbabeltrace2-common.la \
96 $(top_builddir)/src/logging/libbabeltrace2-logging.la \
97 $(POPT_LIBS)
98 babeltrace2_log_bin_CFLAGS = $(AM_CFLAGS) '-DBT_CLI_PATH="$(abs_top_builddir)/src/cli/babeltrace2$(EXEEXT)"'
99
100 # Only used for in-tree execution and tests
101 babeltrace2_log_SOURCES = $(babeltrace2_log_bin_SOURCES)
102 babeltrace2_log_LDADD = $(babeltrace2_log_bin_LDADD)
103 babeltrace2_log_CFLAGS = $(AM_CFLAGS) '-DBT_CLI_PATH="$(bindir)/babeltrace2$(EXEEXT)"'
This page took 0.033002 seconds and 5 git commands to generate.