diff options
author | Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> | 2019-09-19 17:23:41 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-09-25 08:51:43 -0400 |
commit | 077faf3dc7cc13c3bd784613304bf38696b591da (patch) | |
tree | 89ad2a3e12bb8b225a9317c76b10d1f708b89254 /tools | |
parent | d69094f364d012f6d0be712969e6a6a355b69e84 (diff) |
libtraceevent: Move traceevent plugins in its own subdirectory
All traceevent plugins code is moved to tools/lib/traceevent/plugins
subdirectory. It makes traceevent implementation in trace-cmd and in
kernel tree consistent. There is no changes in the way libtraceevent and
plugins are compiled and installed.
Committer notes:
Applied fixup provided by Steven, fixing the tools/perf/Makefile.perf
target for the plugin dynamic list file. Problem noticed when cross
building to aarch64 from a Ubuntu 19.04 container.
Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lore.kernel.org/lkml/20190923115929.453b68f1@oasis.local.home
Link: http://lore.kernel.org/lkml/20190919212542.377333393@goodmis.org
Link: http://lore.kernel.org/linux-trace-devel/20190917105055.18983-1-tz.stoyanov@gmail.com
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/traceevent/Build | 11 | ||||
-rw-r--r-- | tools/lib/traceevent/Makefile | 94 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/Build | 10 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/Makefile | 222 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/plugin_cfg80211.c (renamed from tools/lib/traceevent/plugin_cfg80211.c) | 0 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/plugin_function.c (renamed from tools/lib/traceevent/plugin_function.c) | 0 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/plugin_hrtimer.c (renamed from tools/lib/traceevent/plugin_hrtimer.c) | 0 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/plugin_jbd2.c (renamed from tools/lib/traceevent/plugin_jbd2.c) | 0 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/plugin_kmem.c (renamed from tools/lib/traceevent/plugin_kmem.c) | 0 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/plugin_kvm.c (renamed from tools/lib/traceevent/plugin_kvm.c) | 0 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/plugin_mac80211.c (renamed from tools/lib/traceevent/plugin_mac80211.c) | 0 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/plugin_sched_switch.c (renamed from tools/lib/traceevent/plugin_sched_switch.c) | 0 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/plugin_scsi.c (renamed from tools/lib/traceevent/plugin_scsi.c) | 0 | ||||
-rw-r--r-- | tools/lib/traceevent/plugins/plugin_xen.c (renamed from tools/lib/traceevent/plugin_xen.c) | 0 | ||||
-rw-r--r-- | tools/perf/Makefile.perf | 4 |
15 files changed, 250 insertions, 91 deletions
diff --git a/tools/lib/traceevent/Build b/tools/lib/traceevent/Build index ba54bfce0b0b..f9a5d79578f5 100644 --- a/tools/lib/traceevent/Build +++ b/tools/lib/traceevent/Build | |||
@@ -6,14 +6,3 @@ libtraceevent-y += parse-utils.o | |||
6 | libtraceevent-y += kbuffer-parse.o | 6 | libtraceevent-y += kbuffer-parse.o |
7 | libtraceevent-y += tep_strerror.o | 7 | libtraceevent-y += tep_strerror.o |
8 | libtraceevent-y += event-parse-api.o | 8 | libtraceevent-y += event-parse-api.o |
9 | |||
10 | plugin_jbd2-y += plugin_jbd2.o | ||
11 | plugin_hrtimer-y += plugin_hrtimer.o | ||
12 | plugin_kmem-y += plugin_kmem.o | ||
13 | plugin_kvm-y += plugin_kvm.o | ||
14 | plugin_mac80211-y += plugin_mac80211.o | ||
15 | plugin_sched_switch-y += plugin_sched_switch.o | ||
16 | plugin_function-y += plugin_function.o | ||
17 | plugin_xen-y += plugin_xen.o | ||
18 | plugin_scsi-y += plugin_scsi.o | ||
19 | plugin_cfg80211-y += plugin_cfg80211.o | ||
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile index a39cdd0d890d..5315f3787f8d 100644 --- a/tools/lib/traceevent/Makefile +++ b/tools/lib/traceevent/Makefile | |||
@@ -58,30 +58,6 @@ export man_dir man_dir_SQ INSTALL | |||
58 | export DESTDIR DESTDIR_SQ | 58 | export DESTDIR DESTDIR_SQ |
59 | export EVENT_PARSE_VERSION | 59 | export EVENT_PARSE_VERSION |
60 | 60 | ||
61 | set_plugin_dir := 1 | ||
62 | |||
63 | # Set plugin_dir to preffered global plugin location | ||
64 | # If we install under $HOME directory we go under | ||
65 | # $(HOME)/.local/lib/traceevent/plugins | ||
66 | # | ||
67 | # We dont set PLUGIN_DIR in case we install under $HOME | ||
68 | # directory, because by default the code looks under: | ||
69 | # $(HOME)/.local/lib/traceevent/plugins by default. | ||
70 | # | ||
71 | ifeq ($(plugin_dir),) | ||
72 | ifeq ($(prefix),$(HOME)) | ||
73 | override plugin_dir = $(HOME)/.local/lib/traceevent/plugins | ||
74 | set_plugin_dir := 0 | ||
75 | else | ||
76 | override plugin_dir = $(libdir)/traceevent/plugins | ||
77 | endif | ||
78 | endif | ||
79 | |||
80 | ifeq ($(set_plugin_dir),1) | ||
81 | PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)" | ||
82 | PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))' | ||
83 | endif | ||
84 | |||
85 | include ../../scripts/Makefile.include | 61 | include ../../scripts/Makefile.include |
86 | 62 | ||
87 | # copy a bit from Linux kbuild | 63 | # copy a bit from Linux kbuild |
@@ -105,7 +81,6 @@ export prefix libdir src obj | |||
105 | # Shell quotes | 81 | # Shell quotes |
106 | libdir_SQ = $(subst ','\'',$(libdir)) | 82 | libdir_SQ = $(subst ','\'',$(libdir)) |
107 | libdir_relative_SQ = $(subst ','\'',$(libdir_relative)) | 83 | libdir_relative_SQ = $(subst ','\'',$(libdir_relative)) |
108 | plugin_dir_SQ = $(subst ','\'',$(plugin_dir)) | ||
109 | 84 | ||
110 | CONFIG_INCLUDES = | 85 | CONFIG_INCLUDES = |
111 | CONFIG_LIBS = | 86 | CONFIG_LIBS = |
@@ -151,29 +126,14 @@ MAKEOVERRIDES= | |||
151 | export srctree OUTPUT CC LD CFLAGS V | 126 | export srctree OUTPUT CC LD CFLAGS V |
152 | build := -f $(srctree)/tools/build/Makefile.build dir=. obj | 127 | build := -f $(srctree)/tools/build/Makefile.build dir=. obj |
153 | 128 | ||
154 | PLUGINS = plugin_jbd2.so | ||
155 | PLUGINS += plugin_hrtimer.so | ||
156 | PLUGINS += plugin_kmem.so | ||
157 | PLUGINS += plugin_kvm.so | ||
158 | PLUGINS += plugin_mac80211.so | ||
159 | PLUGINS += plugin_sched_switch.so | ||
160 | PLUGINS += plugin_function.so | ||
161 | PLUGINS += plugin_xen.so | ||
162 | PLUGINS += plugin_scsi.so | ||
163 | PLUGINS += plugin_cfg80211.so | ||
164 | |||
165 | PLUGINS := $(addprefix $(OUTPUT),$(PLUGINS)) | ||
166 | PLUGINS_IN := $(PLUGINS:.so=-in.o) | ||
167 | |||
168 | TE_IN := $(OUTPUT)libtraceevent-in.o | 129 | TE_IN := $(OUTPUT)libtraceevent-in.o |
169 | LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET)) | 130 | LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET)) |
170 | DYNAMIC_LIST_FILE := $(OUTPUT)libtraceevent-dynamic-list | ||
171 | 131 | ||
172 | CMD_TARGETS = $(LIB_TARGET) $(PLUGINS) $(DYNAMIC_LIST_FILE) | 132 | CMD_TARGETS = $(LIB_TARGET) |
173 | 133 | ||
174 | TARGETS = $(CMD_TARGETS) | 134 | TARGETS = $(CMD_TARGETS) |
175 | 135 | ||
176 | all: all_cmd | 136 | all: all_cmd plugins |
177 | 137 | ||
178 | all_cmd: $(CMD_TARGETS) | 138 | all_cmd: $(CMD_TARGETS) |
179 | 139 | ||
@@ -188,17 +148,6 @@ $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN) | |||
188 | $(OUTPUT)libtraceevent.a: $(TE_IN) | 148 | $(OUTPUT)libtraceevent.a: $(TE_IN) |
189 | $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^ | 149 | $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^ |
190 | 150 | ||
191 | $(OUTPUT)libtraceevent-dynamic-list: $(PLUGINS) | ||
192 | $(QUIET_GEN)$(call do_generate_dynamic_list_file, $(PLUGINS), $@) | ||
193 | |||
194 | plugins: $(PLUGINS) | ||
195 | |||
196 | __plugin_obj = $(notdir $@) | ||
197 | plugin_obj = $(__plugin_obj:-in.o=) | ||
198 | |||
199 | $(PLUGINS_IN): force | ||
200 | $(Q)$(MAKE) $(build)=$(plugin_obj) | ||
201 | |||
202 | $(OUTPUT)%.so: $(OUTPUT)%-in.o | 151 | $(OUTPUT)%.so: $(OUTPUT)%-in.o |
203 | $(QUIET_LINK)$(CC) $(CFLAGS) -shared $(LDFLAGS) -nostartfiles -o $@ $^ | 152 | $(QUIET_LINK)$(CC) $(CFLAGS) -shared $(LDFLAGS) -nostartfiles -o $@ $^ |
204 | 153 | ||
@@ -258,25 +207,6 @@ define do_install | |||
258 | $(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2' | 207 | $(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2' |
259 | endef | 208 | endef |
260 | 209 | ||
261 | define do_install_plugins | ||
262 | for plugin in $1; do \ | ||
263 | $(call do_install,$$plugin,$(plugin_dir_SQ)); \ | ||
264 | done | ||
265 | endef | ||
266 | |||
267 | define do_generate_dynamic_list_file | ||
268 | symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \ | ||
269 | xargs echo "U w W" | tr 'w ' 'W\n' | sort -u | xargs echo`;\ | ||
270 | if [ "$$symbol_type" = "U W" ];then \ | ||
271 | (echo '{'; \ | ||
272 | $(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\ | ||
273 | echo '};'; \ | ||
274 | ) > $2; \ | ||
275 | else \ | ||
276 | (echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\ | ||
277 | fi | ||
278 | endef | ||
279 | |||
280 | PKG_CONFIG_FILE = libtraceevent.pc | 210 | PKG_CONFIG_FILE = libtraceevent.pc |
281 | define do_install_pkgconfig_file | 211 | define do_install_pkgconfig_file |
282 | if [ -n "${pkgconfig_dir}" ]; then \ | 212 | if [ -n "${pkgconfig_dir}" ]; then \ |
@@ -296,10 +226,6 @@ install_lib: all_cmd install_plugins install_headers install_pkgconfig | |||
296 | $(call do_install_mkdir,$(libdir_SQ)); \ | 226 | $(call do_install_mkdir,$(libdir_SQ)); \ |
297 | cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ) | 227 | cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ) |
298 | 228 | ||
299 | install_plugins: $(PLUGINS) | ||
300 | $(call QUIET_INSTALL, trace_plugins) \ | ||
301 | $(call do_install_plugins, $(PLUGINS)) | ||
302 | |||
303 | install_pkgconfig: | 229 | install_pkgconfig: |
304 | $(call QUIET_INSTALL, $(PKG_CONFIG_FILE)) \ | 230 | $(call QUIET_INSTALL, $(PKG_CONFIG_FILE)) \ |
305 | $(call do_install_pkgconfig_file,$(prefix)) | 231 | $(call do_install_pkgconfig_file,$(prefix)) |
@@ -313,7 +239,7 @@ install_headers: | |||
313 | 239 | ||
314 | install: install_lib | 240 | install: install_lib |
315 | 241 | ||
316 | clean: | 242 | clean: clean_plugins |
317 | $(call QUIET_CLEAN, libtraceevent) \ | 243 | $(call QUIET_CLEAN, libtraceevent) \ |
318 | $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \ | 244 | $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \ |
319 | $(RM) TRACEEVENT-CFLAGS tags TAGS; \ | 245 | $(RM) TRACEEVENT-CFLAGS tags TAGS; \ |
@@ -351,7 +277,19 @@ help: | |||
351 | @echo ' doc-install - install the man pages' | 277 | @echo ' doc-install - install the man pages' |
352 | @echo ' doc-uninstall - uninstall the man pages' | 278 | @echo ' doc-uninstall - uninstall the man pages' |
353 | @echo'' | 279 | @echo'' |
354 | PHONY += force plugins | 280 | |
281 | PHONY += plugins | ||
282 | plugins: | ||
283 | $(call descend,plugins) | ||
284 | |||
285 | PHONY += install_plugins | ||
286 | install_plugins: | ||
287 | $(call descend,plugins,install) | ||
288 | |||
289 | PHONY += clean_plugins | ||
290 | clean_plugins: | ||
291 | $(call descend,plugins,clean) | ||
292 | |||
355 | force: | 293 | force: |
356 | 294 | ||
357 | # Declare the contents of the .PHONY variable as phony. We keep that | 295 | # Declare the contents of the .PHONY variable as phony. We keep that |
diff --git a/tools/lib/traceevent/plugins/Build b/tools/lib/traceevent/plugins/Build new file mode 100644 index 000000000000..210d26910613 --- /dev/null +++ b/tools/lib/traceevent/plugins/Build | |||
@@ -0,0 +1,10 @@ | |||
1 | plugin_jbd2-y += plugin_jbd2.o | ||
2 | plugin_hrtimer-y += plugin_hrtimer.o | ||
3 | plugin_kmem-y += plugin_kmem.o | ||
4 | plugin_kvm-y += plugin_kvm.o | ||
5 | plugin_mac80211-y += plugin_mac80211.o | ||
6 | plugin_sched_switch-y += plugin_sched_switch.o | ||
7 | plugin_function-y += plugin_function.o | ||
8 | plugin_xen-y += plugin_xen.o | ||
9 | plugin_scsi-y += plugin_scsi.o | ||
10 | plugin_cfg80211-y += plugin_cfg80211.o | ||
diff --git a/tools/lib/traceevent/plugins/Makefile b/tools/lib/traceevent/plugins/Makefile new file mode 100644 index 000000000000..f440989fa55e --- /dev/null +++ b/tools/lib/traceevent/plugins/Makefile | |||
@@ -0,0 +1,222 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
2 | |||
3 | #MAKEFLAGS += --no-print-directory | ||
4 | |||
5 | |||
6 | # Makefiles suck: This macro sets a default value of $(2) for the | ||
7 | # variable named by $(1), unless the variable has been set by | ||
8 | # environment or command line. This is necessary for CC and AR | ||
9 | # because make sets default values, so the simpler ?= approach | ||
10 | # won't work as expected. | ||
11 | define allow-override | ||
12 | $(if $(or $(findstring environment,$(origin $(1))),\ | ||
13 | $(findstring command line,$(origin $(1)))),,\ | ||
14 | $(eval $(1) = $(2))) | ||
15 | endef | ||
16 | |||
17 | # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix. | ||
18 | $(call allow-override,CC,$(CROSS_COMPILE)gcc) | ||
19 | $(call allow-override,AR,$(CROSS_COMPILE)ar) | ||
20 | $(call allow-override,NM,$(CROSS_COMPILE)nm) | ||
21 | $(call allow-override,PKG_CONFIG,pkg-config) | ||
22 | |||
23 | EXT = -std=gnu99 | ||
24 | INSTALL = install | ||
25 | |||
26 | # Use DESTDIR for installing into a different root directory. | ||
27 | # This is useful for building a package. The program will be | ||
28 | # installed in this directory as if it was the root directory. | ||
29 | # Then the build tool can move it later. | ||
30 | DESTDIR ?= | ||
31 | DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' | ||
32 | |||
33 | LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) | ||
34 | ifeq ($(LP64), 1) | ||
35 | libdir_relative = lib64 | ||
36 | else | ||
37 | libdir_relative = lib | ||
38 | endif | ||
39 | |||
40 | prefix ?= /usr/local | ||
41 | libdir = $(prefix)/$(libdir_relative) | ||
42 | |||
43 | set_plugin_dir := 1 | ||
44 | |||
45 | # Set plugin_dir to preffered global plugin location | ||
46 | # If we install under $HOME directory we go under | ||
47 | # $(HOME)/.local/lib/traceevent/plugins | ||
48 | # | ||
49 | # We dont set PLUGIN_DIR in case we install under $HOME | ||
50 | # directory, because by default the code looks under: | ||
51 | # $(HOME)/.local/lib/traceevent/plugins by default. | ||
52 | # | ||
53 | ifeq ($(plugin_dir),) | ||
54 | ifeq ($(prefix),$(HOME)) | ||
55 | override plugin_dir = $(HOME)/.local/lib/traceevent/plugins | ||
56 | set_plugin_dir := 0 | ||
57 | else | ||
58 | override plugin_dir = $(libdir)/traceevent/plugins | ||
59 | endif | ||
60 | endif | ||
61 | |||
62 | ifeq ($(set_plugin_dir),1) | ||
63 | PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)" | ||
64 | PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))' | ||
65 | endif | ||
66 | |||
67 | include ../../../scripts/Makefile.include | ||
68 | |||
69 | # copy a bit from Linux kbuild | ||
70 | |||
71 | ifeq ("$(origin V)", "command line") | ||
72 | VERBOSE = $(V) | ||
73 | endif | ||
74 | ifndef VERBOSE | ||
75 | VERBOSE = 0 | ||
76 | endif | ||
77 | |||
78 | ifeq ($(srctree),) | ||
79 | srctree := $(patsubst %/,%,$(dir $(CURDIR))) | ||
80 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
81 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
82 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
83 | #$(info Determined 'srctree' to be $(srctree)) | ||
84 | endif | ||
85 | |||
86 | export prefix libdir src obj | ||
87 | |||
88 | # Shell quotes | ||
89 | plugin_dir_SQ = $(subst ','\'',$(plugin_dir)) | ||
90 | |||
91 | CONFIG_INCLUDES = | ||
92 | CONFIG_LIBS = | ||
93 | CONFIG_FLAGS = | ||
94 | |||
95 | OBJ = $@ | ||
96 | N = | ||
97 | |||
98 | INCLUDES = -I. -I.. -I $(srctree)/tools/include $(CONFIG_INCLUDES) | ||
99 | |||
100 | # Set compile option CFLAGS | ||
101 | ifdef EXTRA_CFLAGS | ||
102 | CFLAGS := $(EXTRA_CFLAGS) | ||
103 | else | ||
104 | CFLAGS := -g -Wall | ||
105 | endif | ||
106 | |||
107 | # Append required CFLAGS | ||
108 | override CFLAGS += -fPIC | ||
109 | override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) | ||
110 | override CFLAGS += $(udis86-flags) -D_GNU_SOURCE | ||
111 | |||
112 | ifeq ($(VERBOSE),1) | ||
113 | Q = | ||
114 | else | ||
115 | Q = @ | ||
116 | endif | ||
117 | |||
118 | # Disable command line variables (CFLAGS) override from top | ||
119 | # level Makefile (perf), otherwise build Makefile will get | ||
120 | # the same command line setup. | ||
121 | MAKEOVERRIDES= | ||
122 | |||
123 | export srctree OUTPUT CC LD CFLAGS V | ||
124 | |||
125 | build := -f $(srctree)/tools/build/Makefile.build dir=. obj | ||
126 | |||
127 | DYNAMIC_LIST_FILE := $(OUTPUT)libtraceevent-dynamic-list | ||
128 | |||
129 | PLUGINS = plugin_jbd2.so | ||
130 | PLUGINS += plugin_hrtimer.so | ||
131 | PLUGINS += plugin_kmem.so | ||
132 | PLUGINS += plugin_kvm.so | ||
133 | PLUGINS += plugin_mac80211.so | ||
134 | PLUGINS += plugin_sched_switch.so | ||
135 | PLUGINS += plugin_function.so | ||
136 | PLUGINS += plugin_xen.so | ||
137 | PLUGINS += plugin_scsi.so | ||
138 | PLUGINS += plugin_cfg80211.so | ||
139 | |||
140 | PLUGINS := $(addprefix $(OUTPUT),$(PLUGINS)) | ||
141 | PLUGINS_IN := $(PLUGINS:.so=-in.o) | ||
142 | |||
143 | plugins: $(PLUGINS) $(DYNAMIC_LIST_FILE) | ||
144 | |||
145 | __plugin_obj = $(notdir $@) | ||
146 | plugin_obj = $(__plugin_obj:-in.o=) | ||
147 | |||
148 | $(PLUGINS_IN): force | ||
149 | $(Q)$(MAKE) $(build)=$(plugin_obj) | ||
150 | |||
151 | $(OUTPUT)libtraceevent-dynamic-list: $(PLUGINS) | ||
152 | $(QUIET_GEN)$(call do_generate_dynamic_list_file, $(PLUGINS), $@) | ||
153 | |||
154 | $(OUTPUT)%.so: $(OUTPUT)%-in.o | ||
155 | $(QUIET_LINK)$(CC) $(CFLAGS) -shared $(LDFLAGS) -nostartfiles -o $@ $^ | ||
156 | |||
157 | define update_dir | ||
158 | (echo $1 > $@.tmp; \ | ||
159 | if [ -r $@ ] && cmp -s $@ $@.tmp; then \ | ||
160 | rm -f $@.tmp; \ | ||
161 | else \ | ||
162 | echo ' UPDATE $@'; \ | ||
163 | mv -f $@.tmp $@; \ | ||
164 | fi); | ||
165 | endef | ||
166 | |||
167 | tags: force | ||
168 | $(RM) tags | ||
169 | find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \ | ||
170 | --regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/' | ||
171 | |||
172 | TAGS: force | ||
173 | $(RM) TAGS | ||
174 | find . -name '*.[ch]' | xargs etags \ | ||
175 | --regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/' | ||
176 | |||
177 | define do_install_mkdir | ||
178 | if [ ! -d '$(DESTDIR_SQ)$1' ]; then \ | ||
179 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1'; \ | ||
180 | fi | ||
181 | endef | ||
182 | |||
183 | define do_install | ||
184 | $(call do_install_mkdir,$2); \ | ||
185 | $(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2' | ||
186 | endef | ||
187 | |||
188 | define do_install_plugins | ||
189 | for plugin in $1; do \ | ||
190 | $(call do_install,$$plugin,$(plugin_dir_SQ)); \ | ||
191 | done | ||
192 | endef | ||
193 | |||
194 | define do_generate_dynamic_list_file | ||
195 | symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \ | ||
196 | xargs echo "U w W" | tr 'w ' 'W\n' | sort -u | xargs echo`;\ | ||
197 | if [ "$$symbol_type" = "U W" ];then \ | ||
198 | (echo '{'; \ | ||
199 | $(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\ | ||
200 | echo '};'; \ | ||
201 | ) > $2; \ | ||
202 | else \ | ||
203 | (echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\ | ||
204 | fi | ||
205 | endef | ||
206 | |||
207 | install: $(PLUGINS) | ||
208 | $(call QUIET_INSTALL, trace_plugins) \ | ||
209 | $(call do_install_plugins, $(PLUGINS)) | ||
210 | |||
211 | clean: | ||
212 | $(call QUIET_CLEAN, trace_plugins) \ | ||
213 | $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \ | ||
214 | $(RM) $(OUTPUT)libtraceevent-dynamic-list \ | ||
215 | $(RM) TRACEEVENT-CFLAGS tags TAGS; | ||
216 | |||
217 | PHONY += force plugins | ||
218 | force: | ||
219 | |||
220 | # Declare the contents of the .PHONY variable as phony. We keep that | ||
221 | # information in a variable so we can use it in if_changed and friends. | ||
222 | .PHONY: $(PHONY) | ||
diff --git a/tools/lib/traceevent/plugin_cfg80211.c b/tools/lib/traceevent/plugins/plugin_cfg80211.c index 3d43b56a6c98..3d43b56a6c98 100644 --- a/tools/lib/traceevent/plugin_cfg80211.c +++ b/tools/lib/traceevent/plugins/plugin_cfg80211.c | |||
diff --git a/tools/lib/traceevent/plugin_function.c b/tools/lib/traceevent/plugins/plugin_function.c index 7770fcb78e0f..7770fcb78e0f 100644 --- a/tools/lib/traceevent/plugin_function.c +++ b/tools/lib/traceevent/plugins/plugin_function.c | |||
diff --git a/tools/lib/traceevent/plugin_hrtimer.c b/tools/lib/traceevent/plugins/plugin_hrtimer.c index bb434e0ed03a..bb434e0ed03a 100644 --- a/tools/lib/traceevent/plugin_hrtimer.c +++ b/tools/lib/traceevent/plugins/plugin_hrtimer.c | |||
diff --git a/tools/lib/traceevent/plugin_jbd2.c b/tools/lib/traceevent/plugins/plugin_jbd2.c index 04fc125f38cb..04fc125f38cb 100644 --- a/tools/lib/traceevent/plugin_jbd2.c +++ b/tools/lib/traceevent/plugins/plugin_jbd2.c | |||
diff --git a/tools/lib/traceevent/plugin_kmem.c b/tools/lib/traceevent/plugins/plugin_kmem.c index edaec5d962c3..edaec5d962c3 100644 --- a/tools/lib/traceevent/plugin_kmem.c +++ b/tools/lib/traceevent/plugins/plugin_kmem.c | |||
diff --git a/tools/lib/traceevent/plugin_kvm.c b/tools/lib/traceevent/plugins/plugin_kvm.c index c8e623065a7e..c8e623065a7e 100644 --- a/tools/lib/traceevent/plugin_kvm.c +++ b/tools/lib/traceevent/plugins/plugin_kvm.c | |||
diff --git a/tools/lib/traceevent/plugin_mac80211.c b/tools/lib/traceevent/plugins/plugin_mac80211.c index 884303c26b5c..884303c26b5c 100644 --- a/tools/lib/traceevent/plugin_mac80211.c +++ b/tools/lib/traceevent/plugins/plugin_mac80211.c | |||
diff --git a/tools/lib/traceevent/plugin_sched_switch.c b/tools/lib/traceevent/plugins/plugin_sched_switch.c index 957389a0ff7a..957389a0ff7a 100644 --- a/tools/lib/traceevent/plugin_sched_switch.c +++ b/tools/lib/traceevent/plugins/plugin_sched_switch.c | |||
diff --git a/tools/lib/traceevent/plugin_scsi.c b/tools/lib/traceevent/plugins/plugin_scsi.c index 5d0387a4b65a..5d0387a4b65a 100644 --- a/tools/lib/traceevent/plugin_scsi.c +++ b/tools/lib/traceevent/plugins/plugin_scsi.c | |||
diff --git a/tools/lib/traceevent/plugin_xen.c b/tools/lib/traceevent/plugins/plugin_xen.c index 993b208d0323..993b208d0323 100644 --- a/tools/lib/traceevent/plugin_xen.c +++ b/tools/lib/traceevent/plugins/plugin_xen.c | |||
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 2ccc12f3730b..902c792f326a 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -292,7 +292,7 @@ endif | |||
292 | LIBTRACEEVENT = $(TE_PATH)libtraceevent.a | 292 | LIBTRACEEVENT = $(TE_PATH)libtraceevent.a |
293 | export LIBTRACEEVENT | 293 | export LIBTRACEEVENT |
294 | 294 | ||
295 | LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list | 295 | LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)plugins/libtraceevent-dynamic-list |
296 | 296 | ||
297 | # | 297 | # |
298 | # The static build has no dynsym table, so this does not work for | 298 | # The static build has no dynsym table, so this does not work for |
@@ -737,7 +737,7 @@ libtraceevent_plugins: FORCE | |||
737 | $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins | 737 | $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins |
738 | 738 | ||
739 | $(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins | 739 | $(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins |
740 | $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent-dynamic-list | 740 | $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)plugins/libtraceevent-dynamic-list |
741 | 741 | ||
742 | $(LIBTRACEEVENT)-clean: | 742 | $(LIBTRACEEVENT)-clean: |
743 | $(call QUIET_CLEAN, libtraceevent) | 743 | $(call QUIET_CLEAN, libtraceevent) |