ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = \
- include \
+SUBDIRS = include \
common \
compat \
logging
if WITH_PYTHON_PLUGINS
+# Only build the Python plugin provider shared object if the
+# configuration doesn't ask to make it built-in.
SUBDIRS += python-plugin-provider
endif
PLUGINS_PATH = $(abs_top_builddir)/plugins
+LTTNG_UTILS_PLUGIN_PATH =
+
+if ENABLE_DEBUG_INFO
+LTTNG_UTILS_PLUGIN_PATH += :$(PLUGINS_PATH)/lttng-utils
+endif
+
+IN_TREE_PLUGIN_PATH = $(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH)
+
AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include \
- -DCONFIG_IN_TREE_PLUGIN_PATH=\"$(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/lttng-utils:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/writer:$(PLUGINS_PATH)/utils\"
+ '-DCONFIG_IN_TREE_PLUGIN_PATH="$(IN_TREE_PLUGIN_PATH)"'
AM_LDFLAGS = -lpopt
bin_PROGRAMS = babeltrace.bin
# -Wl,--no-as-needed is needed for recent gold linker who seems to think
# it knows better and considers libraries with constructors having
# side-effects as dead code.
-babeltrace_bin_LDFLAGS = -Wl, $(LD_NO_AS_NEEDED), -export-dynamic
+babeltrace_bin_LDFLAGS = $(LD_NO_AS_NEEDED) -Wl,-export-dynamic
+
+# Add all the convenience libraries used by Babeltrace plugins and the
+# library. They will be used when embedding plugins (BUILT_IN_PLUGINS),
+# otherwise we're looking after multiple definitions of the same symbols if
+# a plugin's archive (.a) includes the convenience library because
+# we're using --whole-archive below (needed to make sure the linker does
+# not discard the plugins since the CLI does not use their symbols
+# directly).
babeltrace_bin_LDADD = \
$(top_builddir)/lib/libbabeltrace.la \
$(top_builddir)/compat/libcompat.la \
$(top_builddir)/common/libbabeltrace-common.la \
- $(top_builddir)/logging/libbabeltrace-logging.la
+ $(top_builddir)/logging/libbabeltrace-logging.la \
+ $(top_builddir)/plugins/libctfcopytrace/libctfcopytrace.la
if BUILT_IN_PLUGINS
-babeltrace_bin_LDFLAGS += -Wl,--whole-archive,$(top_builddir)/plugins/ctf/.libs/libbabeltrace-plugin-ctf.a,$(top_builddir)/plugins/text/.libs/libbabeltrace-plugin-ctf-text.a,$(top_builddir)/plugins/muxer/.libs/libbabeltrace-plugin-muxer.a,$(top_builddir)/plugins/writer/.libs/libbabeltrace-plugin-ctf-writer.a,--no-whole-archive
+# Takes a plugin name and outputs the needed LDFLAGS to embed it.
+#
+# The --whole-archive option is important here. From the GNU linker's
+# documentation:
+#
+# For each archive mentioned on the command line after the
+# --whole-archive option, include every object file in the archive in
+# the link, rather than searching the archive for the required object
+# files.
+#
+# In our case, we find the plugins thanks to special sections in the
+# binary that are filled by plugin objects. If the linker discards those
+# symbols because the CLI does not use them directly, the CLI reports
+# no plugins found (plugins are effectively not embedded).
+pluginarchive = -Wl,--whole-archive,$(PLUGINS_PATH)/$(1)/.libs/libbabeltrace-plugin-$(1).a,--no-whole-archive
+
+# Built-in plugins
+babeltrace_bin_LDFLAGS += $(call pluginarchive,ctf)
+babeltrace_bin_LDFLAGS += $(call pluginarchive,text)
+babeltrace_bin_LDFLAGS += $(call pluginarchive,utils)
+
+if ENABLE_DEBUG_INFO
+babeltrace_bin_LDFLAGS += $(call pluginarchive,lttng-utils)
+endif
endif
if BABELTRACE_BUILD_WITH_MINGW
fi
if test "x$enable_python_bindings" != xno || test "x$enable_python_plugins" != xno; then
- AM_PATH_PYTHON([3.0], , [AC_MSG_ERROR(Python3 is not available or is not the default Python interpreter on your system. See the README file to learn how to override your distribution's default Python interpreter.)])
+ AM_PATH_PYTHON([3.0], , [AC_MSG_ERROR(Python 3 is not available or is not the default Python interpreter on your system. See the README file to learn how to override your distribution's default Python interpreter.)])
AM_PATH_PYTHON_MODULES([PYTHON])
# pythondir is the path where extra modules are to be installed
])
fi
+AS_IF([test "x$BUILT_IN_PLUGINS" = ""])
+
AM_CONDITIONAL([WITH_PYTHON_PLUGINS], [test "x$enable_python_plugins" != xno])
AS_IF(
[test "x$enable_python_plugins" != xno],
])
AM_CONDITIONAL([BUILT_IN_PLUGINS], [test "x$built_in_plugins" = "xyes"])
-AC_ARG_VAR([BUILT_IN_PYTHON_PLUGIN_SUPPORT], [Statically-link Python plugin support into the babeltrace binary])
+AC_ARG_VAR([BUILT_IN_PYTHON_PLUGIN_SUPPORT], [Statically-link Python plugin support into the babeltrace library])
AS_IF([test "x$BUILT_IN_PYTHON_PLUGIN_SUPPORT" != x], [
# Built-in plug-ins are only available when the --disable-shared --enable-static options are used.
AS_IF([test "x$enable_static" != "xyes"], [AC_MSG_ERROR(--enable-static must be used to bundle Python plugin support in the babeltrace executable)])
AS_IF([test "x$enable_shared" = "xyes"], [AC_MSG_ERROR(--disable-shared must be used to bundle Python plugin support in the babeltrace executable)])
+ AS_IF([test "x$enable_python_plugins" = "xno"], [
+ AC_MSG_ERROR([You can't use BUILT_IN_PYTHON_PLUGIN_SUPPORT=1 without --enable-python-plugins.])
+ ])
built_in_python_plugin_support=yes
AC_DEFINE([BT_BUILT_IN_PYTHON_PLUGIN_SUPPORT], [1], [Define to 1 to register plug-in attributes in static executable sections])
])
libbabeltrace_la_LIBADD = \
prio_heap/libprio_heap.la \
- $(top_builddir)/compat/libcompat.la \
graph/libgraph.la \
plugin/libplugin.la \
- $(top_builddir)/common/libbabeltrace-common.la \
- $(top_builddir)/logging/libbabeltrace-logging.la \
ctf-ir/libctf-ir.la \
ctf-writer/libctf-writer.la
if BUILT_IN_PYTHON_PLUGIN_SUPPORT
libbabeltrace_la_LIBADD += $(top_builddir)/python-plugin-provider/libbabeltrace-python-plugin-provider.la
endif
+
+if !BUILT_IN_PLUGINS
+libbabeltrace_la_LIBADD += \
+ $(top_builddir)/logging/libbabeltrace-logging.la \
+ $(top_builddir)/common/libbabeltrace-common.la \
+ $(top_builddir)/compat/libcompat.la
+endif
-version-info $(BABELTRACE_LIBRARY_VERSION)
libbabeltrace_plugin_ctf_la_LIBADD = \
- $(top_builddir)/lib/libbabeltrace.la \
fs-src/libbabeltrace-plugin-ctf-fs.la \
lttng-live/libbabeltrace-plugin-ctf-lttng-live.la \
fs-sink/libbabeltrace-plugin-ctf-writer.la \
+ common/libbabeltrace-plugin-ctf-common.la
+
+if !BUILT_IN_PLUGINS
+libbabeltrace_plugin_ctf_la_LIBADD += \
+ $(top_builddir)/lib/libbabeltrace.la \
$(top_builddir)/logging/libbabeltrace-logging.la \
$(top_builddir)/common/libbabeltrace-common.la
+endif
decoder.c \
decoder.h
-libctf_ast_la_LIBADD = $(top_builddir)/lib/libbabeltrace.la
+libctf_ast_la_LIBADD =
if BABELTRACE_BUILD_WITH_LIBUUID
libctf_ast_la_LIBADD += -luuid
noinst_LTLIBRARIES = libbabeltrace-plugin-ctf-writer.la
-libbabeltrace_plugin_ctf_writer_la_LIBADD = \
- $(top_builddir)/plugins/libctfcopytrace/libctfcopytrace.la
+libbabeltrace_plugin_ctf_writer_la_LIBADD =
libbabeltrace_plugin_ctf_writer_la_SOURCES = writer.c writer.h write.c
+
+if !BUILT_IN_PLUGINS
+libbabeltrace_plugin_ctf_writer_la_LIBADD += \
+ $(top_builddir)/plugins/libctfcopytrace/libctfcopytrace.la
+endif
noinst_LTLIBRARIES = libbabeltrace-plugin-ctf-fs.la
-libbabeltrace_plugin_ctf_fs_la_LIBADD = \
- $(builddir)/../common/libbabeltrace-plugin-ctf-common.la
libbabeltrace_plugin_ctf_fs_la_SOURCES = \
data-stream-file.c \
data-stream-file.h \
SUBDIRS = .
plugindir = "$(PLUGINSDIR)"
-plugin_LTLIBRARIES = libbabeltrace-plugin-debug-info.la
+plugin_LTLIBRARIES = libbabeltrace-plugin-lttng-utils.la
noinst_HEADERS = \
crc32.h \
utils.h \
copy.h
-libbabeltrace_plugin_debug_info_la_SOURCES = \
+libbabeltrace_plugin_lttng_utils_la_SOURCES = \
plugin.c debug-info.h debug-info.c bin-info.c dwarf.c crc32.c utils.c \
copy.c
-libbabeltrace_plugin_debug_info_la_LDFLAGS = \
+libbabeltrace_plugin_lttng_utils_la_LDFLAGS = \
-version-info $(BABELTRACE_LIBRARY_VERSION) -lelf -ldw
-libbabeltrace_plugin_debug_info_la_LIBADD = \
+if !BUILT_IN_PLUGINS
+libbabeltrace_plugin_lttng_utils_la_LIBADD = \
$(top_builddir)/lib/libbabeltrace.la \
$(top_builddir)/plugins/libctfcopytrace/libctfcopytrace.la
+endif
libbabeltrace_plugin_text_la_LDFLAGS = \
-version-info $(BABELTRACE_LIBRARY_VERSION)
libbabeltrace_plugin_text_la_LIBADD = \
- $(top_builddir)/lib/libbabeltrace.la \
pretty/libbabeltrace-plugin-text-pretty-cc.la
+
+if !BUILT_IN_PLUGINS
+libbabeltrace_plugin_text_la_LIBADD += \
+ $(top_builddir)/lib/libbabeltrace.la \
+ $(top_builddir)/common/libbabeltrace-common.la
+endif
pretty.c \
print.c \
pretty.h
-
-libbabeltrace_plugin_text_pretty_cc_la_LIBADD = \
- $(top_builddir)/common/libbabeltrace-common.la
libbabeltrace_plugin_utils_la_LDFLAGS = \
-version-info $(BABELTRACE_LIBRARY_VERSION)
libbabeltrace_plugin_utils_la_LIBADD = \
- $(top_builddir)/lib/libbabeltrace.la \
dummy/libbabeltrace-plugin-dummy-cc.la \
trimmer/libbabeltrace-plugin-trimmer.la \
muxer/libbabeltrace-plugin-muxer.la
+
+if !BUILT_IN_PLUGINS
+libbabeltrace_plugin_utils_la_LIBADD += \
+ $(top_builddir)/lib/libbabeltrace.la
+endif
iterator.h \
copy.h
-libbabeltrace_plugin_trimmer_la_LIBADD = \
+libbabeltrace_plugin_trimmer_la_LIBADD =
+
+if !BUILT_IN_PLUGINS
+libbabeltrace_plugin_trimmer_la_LIBADD += \
$(top_builddir)/plugins/libctfcopytrace/libctfcopytrace.la
+endif