diff options
| author | Jiri Olsa <jolsa@kernel.org> | 2015-01-07 12:39:45 -0500 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-02-12 15:55:38 -0500 |
| commit | 2d58ab9bdb1958e94f1007882d67c77edda810c0 (patch) | |
| tree | ebbf73afb1b37f29dfc884ef73e224a1430c0591 /tools/lib | |
| parent | 285a8f247b08c2aff83633fb82c217f91455d10b (diff) | |
tools lib traceevent: Use tools build framework
Move the libtraceevent library building under tools build framework.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Tested-by: Will Deacon <will.deacon@arm.com>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/n/tip-opvx59tcawlmm916lg4aff4h@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib')
| -rw-r--r-- | tools/lib/traceevent/Build | 17 | ||||
| -rw-r--r-- | tools/lib/traceevent/Makefile | 169 |
2 files changed, 62 insertions, 124 deletions
diff --git a/tools/lib/traceevent/Build b/tools/lib/traceevent/Build new file mode 100644 index 000000000000..c681d0575d16 --- /dev/null +++ b/tools/lib/traceevent/Build | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | libtraceevent-y += event-parse.o | ||
| 2 | libtraceevent-y += event-plugin.o | ||
| 3 | libtraceevent-y += trace-seq.o | ||
| 4 | libtraceevent-y += parse-filter.o | ||
| 5 | libtraceevent-y += parse-utils.o | ||
| 6 | libtraceevent-y += kbuffer-parse.o | ||
| 7 | |||
| 8 | plugin_jbd2-y += plugin_jbd2.o | ||
| 9 | plugin_hrtimer-y += plugin_hrtimer.o | ||
| 10 | plugin_kmem-y += plugin_kmem.o | ||
| 11 | plugin_kvm-y += plugin_kvm.o | ||
| 12 | plugin_mac80211-y += plugin_mac80211.o | ||
| 13 | plugin_sched_switch-y += plugin_sched_switch.o | ||
| 14 | plugin_function-y += plugin_function.o | ||
| 15 | plugin_xen-y += plugin_xen.o | ||
| 16 | plugin_scsi-y += plugin_scsi.o | ||
| 17 | plugin_cfg80211-y += plugin_cfg80211.o | ||
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile index 005c9cc06935..d410da335e3d 100644 --- a/tools/lib/traceevent/Makefile +++ b/tools/lib/traceevent/Makefile | |||
| @@ -67,7 +67,7 @@ PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)" | |||
| 67 | PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))' | 67 | PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))' |
| 68 | endif | 68 | endif |
| 69 | 69 | ||
| 70 | include $(if $(BUILD_SRC),$(BUILD_SRC)/)../../scripts/Makefile.include | 70 | include ../../scripts/Makefile.include |
| 71 | 71 | ||
| 72 | # copy a bit from Linux kbuild | 72 | # copy a bit from Linux kbuild |
| 73 | 73 | ||
| @@ -78,40 +78,13 @@ ifndef VERBOSE | |||
| 78 | VERBOSE = 0 | 78 | VERBOSE = 0 |
| 79 | endif | 79 | endif |
| 80 | 80 | ||
| 81 | ifeq ("$(origin O)", "command line") | 81 | ifeq ($(srctree),) |
| 82 | BUILD_OUTPUT := $(O) | 82 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) |
| 83 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
| 84 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
| 85 | #$(info Determined 'srctree' to be $(srctree)) | ||
| 83 | endif | 86 | endif |
| 84 | 87 | ||
| 85 | ifeq ($(BUILD_SRC),) | ||
| 86 | ifneq ($(OUTPUT),) | ||
| 87 | |||
| 88 | define build_output | ||
| 89 | $(if $(VERBOSE:1=),@)+$(MAKE) -C $(OUTPUT) \ | ||
| 90 | BUILD_SRC=$(CURDIR)/ -f $(CURDIR)/Makefile $1 | ||
| 91 | endef | ||
| 92 | |||
| 93 | all: sub-make | ||
| 94 | |||
| 95 | $(MAKECMDGOALS): sub-make | ||
| 96 | |||
| 97 | sub-make: force | ||
| 98 | $(call build_output, $(MAKECMDGOALS)) | ||
| 99 | |||
| 100 | |||
| 101 | # Leave processing to above invocation of make | ||
| 102 | skip-makefile := 1 | ||
| 103 | |||
| 104 | endif # OUTPUT | ||
| 105 | endif # BUILD_SRC | ||
| 106 | |||
| 107 | # We process the rest of the Makefile if this is the final invocation of make | ||
| 108 | ifeq ($(skip-makefile),) | ||
| 109 | |||
| 110 | srctree := $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR)) | ||
| 111 | objtree := $(CURDIR) | ||
| 112 | src := $(srctree) | ||
| 113 | obj := $(objtree) | ||
| 114 | |||
| 115 | export prefix bindir src obj | 88 | export prefix bindir src obj |
| 116 | 89 | ||
| 117 | # Shell quotes | 90 | # Shell quotes |
| @@ -132,16 +105,19 @@ EXTRAVERSION = $(EP_EXTRAVERSION) | |||
| 132 | OBJ = $@ | 105 | OBJ = $@ |
| 133 | N = | 106 | N = |
| 134 | 107 | ||
| 135 | export Q VERBOSE | ||
| 136 | |||
| 137 | EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION) | 108 | EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION) |
| 138 | 109 | ||
| 139 | INCLUDES = -I. -I $(srctree)/../../include $(CONFIG_INCLUDES) | 110 | INCLUDES = -I. -I $(srctree)/tools/include $(CONFIG_INCLUDES) |
| 140 | 111 | ||
| 141 | # Set compile option CFLAGS if not set elsewhere | 112 | # Set compile option CFLAGS |
| 142 | CFLAGS ?= -g -Wall | 113 | ifdef EXTRA_CFLAGS |
| 114 | CFLAGS := $(EXTRA_CFLAGS) | ||
| 115 | else | ||
| 116 | CFLAGS := -g -Wall | ||
| 117 | endif | ||
| 143 | 118 | ||
| 144 | # Append required CFLAGS | 119 | # Append required CFLAGS |
| 120 | override CFLAGS += -fPIC | ||
| 145 | override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) | 121 | override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) |
| 146 | override CFLAGS += $(udis86-flags) -D_GNU_SOURCE | 122 | override CFLAGS += $(udis86-flags) -D_GNU_SOURCE |
| 147 | 123 | ||
| @@ -151,74 +127,58 @@ else | |||
| 151 | Q = @ | 127 | Q = @ |
| 152 | endif | 128 | endif |
| 153 | 129 | ||
| 154 | do_compile_shared_library = \ | 130 | # Disable command line variables (CFLAGS) overide from top |
| 155 | ($(print_shared_lib_compile) \ | 131 | # level Makefile (perf), otherwise build Makefile will get |
| 156 | $(CC) --shared $^ -o $@) | 132 | # the same command line setup. |
| 157 | 133 | MAKEOVERRIDES= | |
| 158 | do_plugin_build = \ | ||
| 159 | ($(print_plugin_build) \ | ||
| 160 | $(CC) $(CFLAGS) -shared -nostartfiles -o $@ $<) | ||
| 161 | |||
| 162 | do_build_static_lib = \ | ||
| 163 | ($(print_static_lib_build) \ | ||
| 164 | $(RM) $@; $(AR) rcs $@ $^) | ||
| 165 | |||
| 166 | |||
| 167 | do_compile = $(QUIET_CC)$(CC) -c $(CFLAGS) $(EXT) $< -o $(obj)/$@; | ||
| 168 | 134 | ||
| 169 | $(obj)/%.o: $(src)/%.c | 135 | export srctree OUTPUT CC LD CFLAGS V |
| 170 | $(call do_compile) | 136 | build := -f $(srctree)/tools/build/Makefile.build dir=. obj |
| 171 | 137 | ||
| 172 | %.o: $(src)/%.c | 138 | PLUGINS = plugin_jbd2.so |
| 173 | $(call do_compile) | 139 | PLUGINS += plugin_hrtimer.so |
| 140 | PLUGINS += plugin_kmem.so | ||
| 141 | PLUGINS += plugin_kvm.so | ||
| 142 | PLUGINS += plugin_mac80211.so | ||
| 143 | PLUGINS += plugin_sched_switch.so | ||
| 144 | PLUGINS += plugin_function.so | ||
| 145 | PLUGINS += plugin_xen.so | ||
| 146 | PLUGINS += plugin_scsi.so | ||
| 147 | PLUGINS += plugin_cfg80211.so | ||
| 174 | 148 | ||
| 175 | PEVENT_LIB_OBJS = event-parse.o | 149 | PLUGINS := $(addprefix $(OUTPUT),$(PLUGINS)) |
| 176 | PEVENT_LIB_OBJS += event-plugin.o | 150 | PLUGINS_IN := $(PLUGINS:.so=-in.o) |
| 177 | PEVENT_LIB_OBJS += trace-seq.o | ||
| 178 | PEVENT_LIB_OBJS += parse-filter.o | ||
| 179 | PEVENT_LIB_OBJS += parse-utils.o | ||
| 180 | PEVENT_LIB_OBJS += kbuffer-parse.o | ||
| 181 | 151 | ||
| 182 | PLUGIN_OBJS = plugin_jbd2.o | 152 | TE_IN := $(OUTPUT)libtraceevent-in.o |
| 183 | PLUGIN_OBJS += plugin_hrtimer.o | 153 | LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE)) |
| 184 | PLUGIN_OBJS += plugin_kmem.o | ||
| 185 | PLUGIN_OBJS += plugin_kvm.o | ||
| 186 | PLUGIN_OBJS += plugin_mac80211.o | ||
| 187 | PLUGIN_OBJS += plugin_sched_switch.o | ||
| 188 | PLUGIN_OBJS += plugin_function.o | ||
| 189 | PLUGIN_OBJS += plugin_xen.o | ||
| 190 | PLUGIN_OBJS += plugin_scsi.o | ||
| 191 | PLUGIN_OBJS += plugin_cfg80211.o | ||
| 192 | |||
| 193 | PLUGINS := $(PLUGIN_OBJS:.o=.so) | ||
| 194 | |||
| 195 | ALL_OBJS = $(PEVENT_LIB_OBJS) $(PLUGIN_OBJS) | ||
| 196 | 154 | ||
| 197 | CMD_TARGETS = $(LIB_FILE) $(PLUGINS) | 155 | CMD_TARGETS = $(LIB_FILE) $(PLUGINS) |
| 198 | 156 | ||
| 199 | TARGETS = $(CMD_TARGETS) | 157 | TARGETS = $(CMD_TARGETS) |
| 200 | 158 | ||
| 201 | |||
| 202 | all: all_cmd | 159 | all: all_cmd |
| 203 | 160 | ||
| 204 | all_cmd: $(CMD_TARGETS) | 161 | all_cmd: $(CMD_TARGETS) |
| 205 | 162 | ||
| 206 | libtraceevent.so: $(PEVENT_LIB_OBJS) | 163 | $(TE_IN): force |
| 164 | $(Q)$(MAKE) $(build)=libtraceevent | ||
| 165 | |||
| 166 | $(OUTPUT)libtraceevent.so: $(TE_IN) | ||
| 207 | |||
