All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
	hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl,
	namhyung@kernel.org, jolsa@redhat.com, fweisbec@gmail.com,
	rostedt@goodmis.org, dsahern@gmail.com, tglx@linutronix.de,
	cjashfor@linux.vnet.ibm.com, mingo@elte.hu
Subject: [tip:perf/core] tools lib traceevent: Add plugin build support
Date: Tue, 10 Dec 2013 01:17:46 -0800	[thread overview]
Message-ID: <tip-e0e96d03f004e8953a731053b61e275f276fff01@git.kernel.org> (raw)
In-Reply-To: <1386076182-14484-4-git-send-email-jolsa@redhat.com>

Commit-ID:  e0e96d03f004e8953a731053b61e275f276fff01
Gitweb:     http://git.kernel.org/tip/e0e96d03f004e8953a731053b61e275f276fff01
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Tue, 3 Dec 2013 14:09:17 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 4 Dec 2013 15:17:16 -0300

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>
---
 tools/lib/traceevent/Makefile | 52 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 5 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 2ccb5bc..1526798 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -43,6 +43,30 @@ man_dir_SQ = '$(subst ','\'',$(man_dir))'
 export man_dir man_dir_SQ INSTALL
 export DESTDIR DESTDIR_SQ
 
+set_plugin_dir := 1
+
+# Set plugin_dir to preffered global plugin location
+# If we install under $HOME directory we go under
+# $(HOME)/.traceevent/plugins
+#
+# We dont set PLUGIN_DIR in case we install under $HOME
+# directory, because by default the code looks under:
+# $(HOME)/.traceevent/plugins by default.
+#
+ifeq ($(plugin_dir),)
+ifeq ($(prefix),$(HOME))
+override plugin_dir = $(HOME)/.traceevent/plugins
+set_plugin_dir := 0
+else
+override plugin_dir = $(prefix)/lib/traceevent/plugins
+endif
+endif
+
+ifeq ($(set_plugin_dir),1)
+PLUGIN_DIR = -DPLUGIN_DIR="$(DESTDIR)/$(plugin_dir)"
+PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
+endif
+
 # copy a bit from Linux kbuild
 
 ifeq ("$(origin V)", "command line")
@@ -96,6 +120,7 @@ export prefix bindir src obj
 # Shell quotes
 bindir_SQ = $(subst ','\'',$(bindir))
 bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
+plugin_dir_SQ = $(subst ','\'',$(plugin_dir))
 
 LIB_FILE = libtraceevent.a libtraceevent.so
 
@@ -138,8 +163,8 @@ else
   print_app_build =		echo '  BUILD    '$(OBJ);
   print_fpic_compile =		echo '  CC FPIC  '$(OBJ);
   print_shared_lib_compile =	echo '  BUILD    SHARED LIB '$(OBJ);
-  print_plugin_obj_compile =	echo '  BUILD    PLUGIN OBJ '$(OBJ);
-  print_plugin_build =		echo '  BUILD    PLUGIN     '$(OBJ);
+  print_plugin_obj_compile =	echo '  CC FPIC  '$(OBJ);
+  print_plugin_build =		echo '  BUILD    PLUGIN '$(OBJ);
   print_static_lib_build =	echo '  BUILD    STATIC LIB '$(OBJ);
   print_install =		echo '  INSTALL  '$1'	to	$(DESTDIR_SQ)$2';
 endif
@@ -187,9 +212,11 @@ PEVENT_LIB_OBJS += parse-filter.o
 PEVENT_LIB_OBJS += parse-utils.o
 PEVENT_LIB_OBJS += kbuffer-parse.o
 
-ALL_OBJS = $(PEVENT_LIB_OBJS)
+PLUGINS := $(PLUGIN_OBJS:.o=.so)
+
+ALL_OBJS = $(PEVENT_LIB_OBJS) $(PLUGIN_OBJS)
 
-CMD_TARGETS = $(LIB_FILE)
+CMD_TARGETS = $(LIB_FILE) $(PLUGINS)
 
 TARGETS = $(CMD_TARGETS)
 
@@ -204,9 +231,17 @@ libtraceevent.so: $(PEVENT_LIB_OBJS)
 libtraceevent.a: $(PEVENT_LIB_OBJS)
 	$(Q)$(do_build_static_lib)
 
+plugins: $(PLUGINS)
+
 $(PEVENT_LIB_OBJS): %.o: $(src)/%.c TRACEEVENT-CFLAGS
 	$(Q)$(do_fpic_compile)
 
+$(PLUGIN_OBJS): %.o : $(src)/%.c
+	$(Q)$(do_compile_plugin_obj)
+
+$(PLUGINS): %.so: %.o
+	$(Q)$(do_plugin_build)
+
 define make_version.h
 	(echo '/* This file is automatically generated. Do not modify. */';		\
 	echo \#define VERSION_CODE $(shell						\
@@ -294,9 +329,16 @@ define do_install
 	$(INSTALL) $1 '$(DESTDIR_SQ)$2'
 endef
 
-install_lib: all_cmd
+install_lib: all_cmd install_plugins
 	$(Q)$(call do_install,$(LIB_FILE),$(bindir_SQ))
 
+PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS))
+
+$(PLUGINS_INSTALL): %.install : %.so force
+	$(Q)$(call do_install,$<,$(plugin_dir_SQ))
+
+install_plugins: $(PLUGINS_INSTALL)
+
 install: install_lib
 
 clean:

  reply	other threads:[~2013-12-10  9:18 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 13:09 [PATCHv3 00/28] perf tools: Add traceevent plugins support Jiri Olsa
2013-12-03 13:09 ` [PATCH 01/28] perf tools: Remove stackprotector feature check Jiri Olsa
2013-12-10  9:16   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 02/28] tools lib traceevent: Add plugin support Jiri Olsa
2013-12-10  9:17   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 03/28] tools lib traceevent: Add plugin build support Jiri Olsa
2013-12-10  9:17   ` tip-bot for Jiri Olsa [this message]
2013-12-03 13:09 ` [PATCH 04/28] tools lib traceevent: Add traceevent_host_bigendian function Jiri Olsa
2013-12-10  9:17   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 05/28] tools lib traceevent: Change pevent_parse_format to include pevent handle Jiri Olsa
2013-12-10  9:18   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 06/28] tools lib traceevent: Harmonize the install messages in lib-traceevent Jiri Olsa
2013-12-10  9:18   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 07/28] perf tools: Add build and install plugins targets Jiri Olsa
2013-12-10  9:18   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 08/28] perf tools: Add filename__read_str util function Jiri Olsa
2013-12-10  9:18   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 09/28] perf tools: Add trace-event object Jiri Olsa
2013-12-10  9:18   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 10/28] perf tools: Add trace-event global object for tracepoint interface Jiri Olsa
2013-12-10  9:18   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 11/28] perf tools: Overload pr_stat traceevent print function Jiri Olsa
2013-12-10  9:19   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 12/28] tools lib traceevent: Add jbd2 plugin Jiri Olsa
2013-12-10  9:19   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 13/28] tools lib traceevent: Add hrtimer plugin Jiri Olsa
2013-12-10  9:19   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 14/28] tools lib traceevent: Add kmem plugin Jiri Olsa
2013-12-10  9:19   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 15/28] tools lib traceevent: Add kvm plugin Jiri Olsa
2013-12-10  9:19   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 16/28] tools lib traceevent: Add mac80211 plugin Jiri Olsa
2013-12-10  9:20   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 17/28] tools lib traceevent: Add sched_switch plugin Jiri Olsa
2013-12-10  9:20   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 18/28] tools lib traceevent: Add function plugin Jiri Olsa
2013-12-10  9:20   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 19/28] tools lib traceevent: Add xen plugin Jiri Olsa
2013-12-10  9:20   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 20/28] tools lib traceevent: Add scsi plugin Jiri Olsa
2013-12-10  9:20   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 21/28] tools lib traceevent: Add cfg80211 plugin Jiri Olsa
2013-12-10  9:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 22/28] tools lib traceevent: Remove malloc_or_die from event-plugin.c Jiri Olsa
2013-12-03 16:16   ` Steven Rostedt
2013-12-04  9:29     ` Jiri Olsa
2013-12-04 13:29       ` Arnaldo Carvalho de Melo
2013-12-04 13:51         ` Steven Rostedt
2013-12-10  9:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 23/28] tools lib traceevent: Use static functions in jbd2 plugin Jiri Olsa
2013-12-10  9:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 24/28] tools lib traceevent: Use pevent_print_func_field in hrtimer_start handler Jiri Olsa
2013-12-10  9:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 25/28] tools lib traceevent: Several cleanups for function plugin Jiri Olsa
2013-12-10  9:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 26/28] tools lib traceevent: Remove malloc_or_die from plugin_function.c Jiri Olsa
2013-12-10  9:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 27/28] tools lib traceevent: Update kvm plugin with is_writable_pte helper Jiri Olsa
2013-12-10  9:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-03 13:09 ` [PATCH 28/28] perf tools: Add udis86 disassembler feature check Jiri Olsa
2013-12-04 18:50   ` Arnaldo Carvalho de Melo
2013-12-04 18:53     ` Arnaldo Carvalho de Melo
2013-12-04 21:25       ` Jiri Olsa
2013-12-05  8:05     ` Jiri Olsa
2013-12-05  9:23       ` [PATCHv4 " Jiri Olsa
2013-12-05  9:25       ` [PATCH " Ingo Molnar
2013-12-05  9:41         ` Jiri Olsa
2013-12-05 10:45           ` Ingo Molnar
2013-12-05 13:02             ` Jiri Olsa
2013-12-10 15:31               ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-e0e96d03f004e8953a731053b61e275f276fff01@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.