aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2013-12-03 08:09:17 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-12-04 13:17:16 -0500
commite0e96d03f004e8953a731053b61e275f276fff01 (patch)
tree8b1d03d684ef8769484ae25725d3dce04adcd049
parentc877bbd8eceb14c5eac6779cc804fa8b34044736 (diff)
tools lib traceevent: Add plugin build support
Backporting missing pieces of plugin building infrastructure: - Adding Makefile 'plugins' target to build all defined plugins - Adding Makefile 'install_plugins' target as 'install_lib' target dependency - Link plugin objects with shared object building Backported from Steven Rostedt's trace-cmd repo (HEAD 0f2c2fb): git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git Plugins are by default installed into following locations: '$(HOME)/.traceevent/plugins' - If we are installing under $(HOME) '$(prefix)/lib/traceevent/plugins' - Otherwise This path is propagated to the plugin object as a plugins search path. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1386076182-14484-4-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/lib/traceevent/Makefile52
1 files changed, 47 insertions, 5 deletions
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 2ccb5bc800e8..15267988f6b6 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -43,6 +43,30 @@ man_dir_SQ = '$(subst ','\'',$(man_dir))'
43export man_dir man_dir_SQ INSTALL 43export man_dir man_dir_SQ INSTALL
44export DESTDIR DESTDIR_SQ 44export DESTDIR DESTDIR_SQ
45 45
46set_plugin_dir := 1
47
48# Set plugin_dir to preffered global plugin location
49# If we install under $HOME directory we go under
50# $(HOME)/.traceevent/plugins
51#
52# We dont set PLUGIN_DIR in case we install under $HOME
53# directory, because by default the code looks under:
54# $(HOME)/.traceevent/plugins by default.
55#
56ifeq ($(plugin_dir),)
57ifeq ($(prefix),$(HOME))
58override plugin_dir = $(HOME)/.traceevent/plugins
59set_plugin_dir := 0
60else
61override plugin_dir = $(prefix)/lib/traceevent/plugins
62endif
63endif
64
65ifeq ($(set_plugin_dir),1)
66PLUGIN_DIR = -DPLUGIN_DIR="$(DESTDIR)/$(plugin_dir)"
67PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
68endif
69
46# copy a bit from Linux kbuild 70# copy a bit from Linux kbuild
47 71
48ifeq ("$(origin V)", "command line") 72ifeq ("$(origin V)", "command line")
@@ -96,6 +120,7 @@ export prefix bindir src obj
96# Shell quotes 120# Shell quotes
97bindir_SQ = $(subst ','\'',$(bindir)) 121bindir_SQ = $(subst ','\'',$(bindir))
98bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) 122bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
123plugin_dir_SQ = $(subst ','\'',$(plugin_dir))
99 124
100LIB_FILE = libtraceevent.a libtraceevent.so 125LIB_FILE = libtraceevent.a libtraceevent.so
101 126
@@ -138,8 +163,8 @@ else
138 print_app_build = echo ' BUILD '$(OBJ); 163 print_app_build = echo ' BUILD '$(OBJ);
139 print_fpic_compile = echo ' CC FPIC '$(OBJ); 164 print_fpic_compile = echo ' CC FPIC '$(OBJ);
140 print_shared_lib_compile = echo ' BUILD SHARED LIB '$(OBJ); 165 print_shared_lib_compile = echo ' BUILD SHARED LIB '$(OBJ);
141 print_plugin_obj_compile = echo ' BUILD PLUGIN OBJ '$(OBJ); 166 print_plugin_obj_compile = echo ' CC FPIC '$(OBJ);
142 print_plugin_build = echo ' BUILD PLUGIN '$(OBJ); 167 print_plugin_build = echo ' BUILD PLUGIN '$(OBJ);
143 print_static_lib_build = echo ' BUILD STATIC LIB '$(OBJ); 168 print_static_lib_build = echo ' BUILD STATIC LIB '$(OBJ);
144 print_install = echo ' INSTALL '$1' to $(DESTDIR_SQ)$2'; 169 print_install = echo ' INSTALL '$1' to $(DESTDIR_SQ)$2';
145endif 170endif
@@ -187,9 +212,11 @@ PEVENT_LIB_OBJS += parse-filter.o
187PEVENT_LIB_OBJS += parse-utils.o 212PEVENT_LIB_OBJS += parse-utils.o
188PEVENT_LIB_OBJS += kbuffer-parse.o 213PEVENT_LIB_OBJS += kbuffer-parse.o
189 214
190ALL_OBJS = $(PEVENT_LIB_OBJS) 215PLUGINS := $(PLUGIN_OBJS:.o=.so)
216
217ALL_OBJS = $(PEVENT_LIB_OBJS) $(PLUGIN_OBJS)
191 218
192CMD_TARGETS = $(LIB_FILE) 219CMD_TARGETS = $(LIB_FILE) $(PLUGINS)
193 220
194TARGETS = $(CMD_TARGETS) 221TARGETS = $(CMD_TARGETS)
195 222
@@ -204,9 +231,17 @@ libtraceevent.so: $(PEVENT_LIB_OBJS)
204libtraceevent.a: $(PEVENT_LIB_OBJS) 231libtraceevent.a: $(PEVENT_LIB_OBJS)
205 $(Q)$(do_build_static_lib) 232 $(Q)$(do_build_static_lib)
206 233
234plugins: $(PLUGINS)
235
207$(PEVENT_LIB_OBJS): %.o: $(src)/%.c TRACEEVENT-CFLAGS 236$(PEVENT_LIB_OBJS): %.o: $(src)/%.c TRACEEVENT-CFLAGS
208 $(Q)$(do_fpic_compile) 237 $(Q)$(do_fpic_compile)
209 238
239$(PLUGIN_OBJS): %.o : $(src)/%.c
240 $(Q)$(do_compile_plugin_obj)
241
242$(PLUGINS): %.so: %.o
243 $(Q)$(do_plugin_build)
244
210define make_version.h 245define make_version.h
211 (echo '/* This file is automatically generated. Do not modify. */'; \ 246 (echo '/* This file is automatically generated. Do not modify. */'; \
212 echo \#define VERSION_CODE $(shell \ 247 echo \#define VERSION_CODE $(shell \
@@ -294,9 +329,16 @@ define do_install
294 $(INSTALL) $1 '$(DESTDIR_SQ)$2' 329 $(INSTALL) $1 '$(DESTDIR_SQ)$2'
295endef 330endef
296 331
297install_lib: all_cmd 332install_lib: all_cmd install_plugins
298 $(Q)$(call do_install,$(LIB_FILE),$(bindir_SQ)) 333 $(Q)$(call do_install,$(LIB_FILE),$(bindir_SQ))
299 334
335PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS))
336
337$(PLUGINS_INSTALL): %.install : %.so force
338 $(Q)$(call do_install,$<,$(plugin_dir_SQ))
339
340install_plugins: $(PLUGINS_INSTALL)
341
300install: install_lib 342install: install_lib
301 343
302clean: 344clean: