~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to tools/lib/traceevent/Makefile

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# trace-cmd version
 
2
EP_VERSION = 1
 
3
EP_PATCHLEVEL = 1
 
4
EP_EXTRAVERSION = 0
 
5
 
 
6
# file format version
 
7
FILE_VERSION = 6
 
8
 
 
9
MAKEFLAGS += --no-print-directory
 
10
 
 
11
 
 
12
# Makefiles suck: This macro sets a default value of $(2) for the
 
13
# variable named by $(1), unless the variable has been set by
 
14
# environment or command line. This is necessary for CC and AR
 
15
# because make sets default values, so the simpler ?= approach
 
16
# won't work as expected.
 
17
define allow-override
 
18
  $(if $(or $(findstring environment,$(origin $(1))),\
 
19
            $(findstring command line,$(origin $(1)))),,\
 
20
    $(eval $(1) = $(2)))
 
21
endef
 
22
 
 
23
# Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
 
24
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
 
25
$(call allow-override,AR,$(CROSS_COMPILE)ar)
 
26
 
 
27
EXT = -std=gnu99
 
28
INSTALL = install
 
29
 
 
30
# Use DESTDIR for installing into a different root directory.
 
31
# This is useful for building a package. The program will be
 
32
# installed in this directory as if it was the root directory.
 
33
# Then the build tool can move it later.
 
34
DESTDIR ?=
 
35
DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
 
36
 
 
37
prefix ?= /usr/local
 
38
bindir_relative = bin
 
39
bindir = $(prefix)/$(bindir_relative)
 
40
man_dir = $(prefix)/share/man
 
41
man_dir_SQ = '$(subst ','\'',$(man_dir))'
 
42
html_install = $(prefix)/share/kernelshark/html
 
43
html_install_SQ = '$(subst ','\'',$(html_install))'
 
44
img_install = $(prefix)/share/kernelshark/html/images
 
45
img_install_SQ = '$(subst ','\'',$(img_install))'
 
46
 
 
47
export man_dir man_dir_SQ html_install html_install_SQ INSTALL
 
48
export img_install img_install_SQ
 
49
export DESTDIR DESTDIR_SQ
 
50
 
 
51
# copy a bit from Linux kbuild
 
52
 
 
53
ifeq ("$(origin V)", "command line")
 
54
  VERBOSE = $(V)
 
55
endif
 
56
ifndef VERBOSE
 
57
  VERBOSE = 0
 
58
endif
 
59
 
 
60
ifeq ("$(origin O)", "command line")
 
61
  BUILD_OUTPUT := $(O)
 
62
endif
 
63
 
 
64
ifeq ($(BUILD_SRC),)
 
65
ifneq ($(BUILD_OUTPUT),)
 
66
 
 
67
define build_output
 
68
        $(if $(VERBOSE:1=),@)$(MAKE) -C $(BUILD_OUTPUT)         \
 
69
        BUILD_SRC=$(CURDIR) -f $(CURDIR)/Makefile $1
 
70
endef
 
71
 
 
72
saved-output := $(BUILD_OUTPUT)
 
73
BUILD_OUTPUT := $(shell cd $(BUILD_OUTPUT) && /bin/pwd)
 
74
$(if $(BUILD_OUTPUT),, \
 
75
     $(error output directory "$(saved-output)" does not exist))
 
76
 
 
77
all: sub-make
 
78
 
 
79
gui: force
 
80
        $(call build_output, all_cmd)
 
81
 
 
82
$(filter-out gui,$(MAKECMDGOALS)): sub-make
 
83
 
 
84
sub-make: force
 
85
        $(call build_output, $(MAKECMDGOALS))
 
86
 
 
87
 
 
88
# Leave processing to above invocation of make
 
89
skip-makefile := 1
 
90
 
 
91
endif # BUILD_OUTPUT
 
92
endif # BUILD_SRC
 
93
 
 
94
# We process the rest of the Makefile if this is the final invocation of make
 
95
ifeq ($(skip-makefile),)
 
96
 
 
97
srctree         := $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR))
 
98
objtree         := $(CURDIR)
 
99
src             := $(srctree)
 
100
obj             := $(objtree)
 
101
 
 
102
export prefix bindir src obj
 
103
 
 
104
# Shell quotes
 
105
bindir_SQ = $(subst ','\'',$(bindir))
 
106
bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
 
107
 
 
108
LIB_FILE = libtraceevent.a libtraceevent.so
 
109
 
 
110
CONFIG_INCLUDES = 
 
111
CONFIG_LIBS     =
 
112
CONFIG_FLAGS    =
 
113
 
 
114
VERSION         = $(EP_VERSION)
 
115
PATCHLEVEL      = $(EP_PATCHLEVEL)
 
116
EXTRAVERSION    = $(EP_EXTRAVERSION)
 
117
 
 
118
OBJ             = $@
 
119
N               =
 
120
 
 
121
export Q VERBOSE
 
122
 
 
123
EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION)
 
124
 
 
125
INCLUDES = -I. -I/usr/local/include $(CONFIG_INCLUDES)
 
126
 
 
127
# Set compile option CFLAGS if not set elsewhere
 
128
CFLAGS ?= -g -Wall
 
129
 
 
130
# Append required CFLAGS
 
131
override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
 
132
override CFLAGS += $(udis86-flags)
 
133
 
 
134
ifeq ($(VERBOSE),1)
 
135
  Q =
 
136
  print_compile =
 
137
  print_app_build =
 
138
  print_fpic_compile =
 
139
  print_shared_lib_compile =
 
140
  print_plugin_obj_compile =
 
141
  print_plugin_build =
 
142
  print_install =
 
143
else
 
144
  Q = @
 
145
  print_compile =               echo '  CC                 '$(OBJ);
 
146
  print_app_build =             echo '  BUILD              '$(OBJ);
 
147
  print_fpic_compile =          echo '  CC FPIC            '$(OBJ);
 
148
  print_shared_lib_compile =    echo '  BUILD SHARED LIB   '$(OBJ);
 
149
  print_plugin_obj_compile =    echo '  CC PLUGIN OBJ      '$(OBJ);
 
150
  print_plugin_build =          echo '  CC PLUGI           '$(OBJ);
 
151
  print_static_lib_build =      echo '  BUILD STATIC LIB   '$(OBJ);
 
152
  print_install =               echo '  INSTALL     '$1'        to      $(DESTDIR_SQ)$2';
 
153
endif
 
154
 
 
155
do_fpic_compile =                                       \
 
156
        ($(print_fpic_compile)                          \
 
157
        $(CC) -c $(CFLAGS) $(EXT) -fPIC $< -o $@)
 
158
 
 
159
do_app_build =                                          \
 
160
        ($(print_app_build)                             \
 
161
        $(CC) $^ -rdynamic -o $@ $(CONFIG_LIBS) $(LIBS))
 
162
 
 
163
do_compile_shared_library =                     \
 
164
        ($(print_shared_lib_compile)            \
 
165
        $(CC) --shared $^ -o $@)
 
166
 
 
167
do_compile_plugin_obj =                         \
 
168
        ($(print_plugin_obj_compile)            \
 
169
        $(CC) -c $(CFLAGS) -fPIC -o $@ $<)
 
170
 
 
171
do_plugin_build =                               \
 
172
        ($(print_plugin_build)                  \
 
173
        $(CC) $(CFLAGS) -shared -nostartfiles -o $@ $<)
 
174
 
 
175
do_build_static_lib =                           \
 
176
        ($(print_static_lib_build)              \
 
177
        $(RM) $@;  $(AR) rcs $@ $^)
 
178
 
 
179
 
 
180
define do_compile
 
181
        $(print_compile)                                                \
 
182
        $(CC) -c $(CFLAGS) $(EXT) $< -o $(obj)/$@;
 
183
endef
 
184
 
 
185
$(obj)/%.o: $(src)/%.c
 
186
        $(Q)$(call do_compile)
 
187
 
 
188
%.o: $(src)/%.c
 
189
        $(Q)$(call do_compile)
 
190
 
 
191
PEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o
 
192
 
 
193
ALL_OBJS = $(PEVENT_LIB_OBJS)
 
194
 
 
195
CMD_TARGETS = $(LIB_FILE)
 
196
 
 
197
TARGETS = $(CMD_TARGETS)
 
198
 
 
199
 
 
200
all: all_cmd
 
201
 
 
202
all_cmd: $(CMD_TARGETS)
 
203
 
 
204
libtraceevent.so: $(PEVENT_LIB_OBJS)
 
205
        $(Q)$(do_compile_shared_library)
 
206
 
 
207
libtraceevent.a: $(PEVENT_LIB_OBJS)
 
208
        $(Q)$(do_build_static_lib)
 
209
 
 
210
$(PEVENT_LIB_OBJS): %.o: $(src)/%.c
 
211
        $(Q)$(do_fpic_compile)
 
212
 
 
213
define make_version.h
 
214
        (echo '/* This file is automatically generated. Do not modify. */';             \
 
215
        echo \#define VERSION_CODE $(shell                                              \
 
216
        expr $(VERSION) \* 256 + $(PATCHLEVEL));                                        \
 
217
        echo '#define EXTRAVERSION ' $(EXTRAVERSION);                                   \
 
218
        echo '#define VERSION_STRING "'$(VERSION).$(PATCHLEVEL).$(EXTRAVERSION)'"';     \
 
219
        echo '#define FILE_VERSION '$(FILE_VERSION);                                    \
 
220
        ) > $1
 
221
endef
 
222
 
 
223
define update_version.h
 
224
        ($(call make_version.h, $@.tmp);                \
 
225
        if [ -r $@ ] && cmp -s $@ $@.tmp; then          \
 
226
                rm -f $@.tmp;                           \
 
227
        else                                            \
 
228
                echo '  UPDATE                 $@';     \
 
229
                mv -f $@.tmp $@;                        \
 
230
        fi);
 
231
endef
 
232
 
 
233
ep_version.h: force
 
234
        $(Q)$(N)$(call update_version.h)
 
235
 
 
236
VERSION_FILES = ep_version.h
 
237
 
 
238
define update_dir
 
239
        (echo $1 > $@.tmp;      \
 
240
        if [ -r $@ ] && cmp -s $@ $@.tmp; then          \
 
241
                rm -f $@.tmp;                           \
 
242
        else                                            \
 
243
                echo '  UPDATE                 $@';     \
 
244
                mv -f $@.tmp $@;                        \
 
245
        fi);
 
246
endef
 
247
 
 
248
## make deps
 
249
 
 
250
all_objs := $(sort $(ALL_OBJS))
 
251
all_deps := $(all_objs:%.o=.%.d)
 
252
 
 
253
define check_deps
 
254
                $(CC) -M $(CFLAGS) $< > $@;
 
255
endef
 
256
 
 
257
$(gui_deps): ks_version.h
 
258
$(non_gui_deps): tc_version.h
 
259
 
 
260
$(all_deps): .%.d: $(src)/%.c
 
261
        $(Q)$(call check_deps)
 
262
 
 
263
$(all_objs) : %.o : .%.d
 
264
 
 
265
dep_includes := $(wildcard $(all_deps))
 
266
 
 
267
ifneq ($(dep_includes),)
 
268
 include $(dep_includes)
 
269
endif
 
270
 
 
271
tags:   force
 
272
        $(RM) tags
 
273
        find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px
 
274
 
 
275
TAGS:   force
 
276
        $(RM) TAGS
 
277
        find . -name '*.[ch]' | xargs etags
 
278
 
 
279
define do_install
 
280
        $(print_install)                                \
 
281
        if [ ! -d '$(DESTDIR_SQ)$2' ]; then             \
 
282
                $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
 
283
        fi;                                             \
 
284
        $(INSTALL) $1 '$(DESTDIR_SQ)$2'
 
285
endef
 
286
 
 
287
install_lib: all_cmd install_plugins install_python
 
288
        $(Q)$(call do_install,$(LIB_FILE),$(bindir_SQ))
 
289
 
 
290
install: install_lib
 
291
 
 
292
clean:
 
293
        $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES).*.d
 
294
        $(RM) tags TAGS
 
295
 
 
296
endif # skip-makefile
 
297
 
 
298
PHONY += force
 
299
force:
 
300
 
 
301
# Declare the contents of the .PHONY variable as phony.  We keep that
 
302
# information in a variable so we can use it in if_changed and friends.
 
303
.PHONY: $(PHONY)