Android.mk revision 7bab52425c117025591387193f874ede77df192a
1# Copyright (C) 2012 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16
17ifeq ($(TARGET_PRODUCT),sdk)
18supported_platforms := none
19else
20supported_platforms := linux-x86 darwin-x86
21endif
22
23cur_platform := $(filter $(HOST_OS)-$(HOST_ARCH),$(supported_platforms))
24
25ifdef cur_platform
26
27#
28# host libperf
29#
30
31include $(CLEAR_VARS)
32
33libperf_src_files := \
34	util/added/rbtree.c \
35	util/abspath.c \
36	util/alias.c \
37	util/annotate.c \
38	util/bitmap.c \
39	util/build-id.c \
40	util/callchain.c \
41	util/cgroup.c \
42	util/color.c \
43	util/config.c \
44	util/cpumap.c \
45	util/ctype.c \
46	util/debug.c \
47	util/debugfs.c \
48	util/environment.c \
49	util/event.c \
50	util/evlist.c \
51	util/evsel.c \
52	util/exec_cmd.c \
53	util/header.c \
54	util/help.c \
55	util/hist.c \
56	util/hweight.c \
57	util/levenshtein.c \
58	util/map.c \
59	util/pager.c \
60	util/parse-events.c \
61	util/parse-options.c \
62	util/path.c \
63	util/probe-event.c \
64	util/probe-finder.c \
65	util/pstack.c \
66	util/quote.c \
67	util/run-command.c \
68	util/session.c \
69	util/sigchain.c \
70	util/sort.c \
71	util/strbuf.c \
72	util/strfilter.c \
73	util/string.c \
74	util/strlist.c \
75	util/svghelper.c \
76	util/symbol.c \
77	util/thread.c \
78	util/thread_map.c \
79	util/top.c \
80	util/trace-event-info.c \
81	util/trace-event-parse.c \
82	util/trace-event-read.c \
83	util/trace-event-scripting.c \
84	util/usage.c \
85	util/util.c \
86	util/values.c \
87	util/wrapper.c \
88	util/xyarray.c
89
90LOCAL_SRC_FILES := $(libperf_src_files)
91
92LOCAL_SRC_FILES += \
93	arch/arm/util/dwarf-regs.c
94
95LOCAL_CFLAGS := -DNO_NEWT_SUPPORT -DNO_LIBPERL -DNO_LIBPYTHON -DNO_STRLCPY -std=gnu99
96
97# temporary until bfd.h is added
98LOCAL_CFLAGS += -DNO_DEMANGLE
99LOCAL_CFLAGS += -DDWARF_SUPPORT
100
101# various macros
102LOCAL_CFLAGS += -DETC_PERFCONFIG='"etc/perfconfig"' \
103                -DPREFIX='""' \
104		-DPERF_EXEC_PATH='"libexec/perf-core"'
105
106# in list.h: entry->next = LIST_POISON1;
107LOCAL_CFLAGS += -Wno-pointer-arith
108
109# for __used
110LOCAL_CFLAGS += -include $(LOCAL_PATH)/util/include/linux/compiler.h
111
112LOCAL_CFLAGS += \
113	-include $(LOCAL_PATH)/host-$(HOST_OS)-fixup/AndroidFixup.h
114
115LOCAL_C_INCLUDES := external/elfutils external/elfutils/libelf external/elfutils/libdw external/elfutils/libdwfl
116
117LOCAL_C_INCLUDES += $(LOCAL_PATH)/host-$(HOST_OS)-fixup
118
119LOCAL_MODULE := libperf
120LOCAL_MODULE_TAGS := eng
121
122include $(BUILD_HOST_STATIC_LIBRARY)
123
124#
125# target libperf
126#
127
128include $(CLEAR_VARS)
129
130LOCAL_SRC_FILES := $(libperf_src_files)
131
132LOCAL_CFLAGS := -DNO_NEWT_SUPPORT -DNO_LIBPERL -DNO_LIBPYTHON -DNO_STRLCPY -std=gnu99
133
134# temporary until bfd.h is added
135LOCAL_CFLAGS += -DNO_DEMANGLE
136LOCAL_CFLAGS += -DDWARF_SUPPORT
137
138# various macros
139LOCAL_CFLAGS += -DETC_PERFCONFIG='"etc/perfconfig"' \
140                -DPREFIX='""' \
141		-DPERF_EXEC_PATH='"libexec/perf-core"'
142
143# in list.h: entry->next = LIST_POISON1;
144LOCAL_CFLAGS += -Wno-pointer-arith
145
146# for __used
147LOCAL_CFLAGS += -include $(LOCAL_PATH)/util/include/linux/compiler.h
148
149# for various GNU extensions
150LOCAL_CFLAGS += -include external/elfutils/bionic-fixup/AndroidFixup.h
151
152LOCAL_CFLAGS += -Wno-attributes -Werror
153
154LOCAL_C_INCLUDES := external/elfutils external/elfutils/libelf external/elfutils/libdw external/elfutils/libdwfl
155
156LOCAL_MODULE := libperf
157LOCAL_MODULE_TAGS := eng
158
159include $(BUILD_STATIC_LIBRARY)
160
161#
162# host perf
163#
164
165include $(CLEAR_VARS)
166
167LOCAL_MODULE := perfhost
168LOCAL_MODULE_TAGS := eng
169
170perf_src_files := \
171	builtin-annotate.c \
172	builtin-buildid-cache.c \
173	builtin-buildid-list.c \
174	builtin-diff.c \
175	builtin-evlist.c \
176	builtin-help.c \
177	builtin-inject.c \
178	builtin-kmem.c \
179	builtin-kvm.c \
180	builtin-list.c \
181	builtin-lock.c \
182	builtin-probe.c \
183	builtin-record.c \
184	builtin-report.c \
185	builtin-sched.c \
186	builtin-script.c \
187	builtin-stat.c \
188	builtin-timechart.c \
189	builtin-top.c \
190	perf.c
191
192LOCAL_SRC_FILES := $(perf_src_files)
193
194LOCAL_STATIC_LIBRARIES := libperf libdwfl libdw libebl libelf
195
196LOCAL_LDLIBS := -lpthread -ldl
197
198# for clock_gettime
199ifeq ($(HOST_OS),linux)
200LOCAL_LDLIBS += -lrt
201endif
202
203# common
204LOCAL_CFLAGS := -DNO_NEWT_SUPPORT -DNO_LIBPERL -DNO_LIBPYTHON -DNO_STRLCPY -std=gnu99
205
206LOCAL_CFLAGS += \
207	-include $(LOCAL_PATH)/host-$(HOST_OS)-fixup/AndroidFixup.h
208
209# in list.h: entry->next = LIST_POISON1;
210LOCAL_CFLAGS += -Wno-pointer-arith
211
212# for __used
213LOCAL_CFLAGS += -include $(LOCAL_PATH)/util/include/linux/compiler.h
214
215# temporary until bfd.h is added
216LOCAL_CFLAGS += -DNO_DEMANGLE
217
218# unique
219LOCAL_CFLAGS += -DPERF_HTML_PATH='""'
220LOCAL_CFLAGS += -DPERF_MAN_PATH='""'
221LOCAL_CFLAGS += -DPERF_INFO_PATH='""'
222LOCAL_CFLAGS += -DPERF_VERSION='"perf.3.0.8_android"'
223
224LOCAL_C_INCLUDES += $(LOCAL_PATH)/host-$(HOST_OS)-fixup
225
226include $(BUILD_HOST_EXECUTABLE)
227
228#
229# target perf
230#
231
232include $(CLEAR_VARS)
233
234LOCAL_MODULE := perf
235LOCAL_MODULE_TAGS := eng
236
237LOCAL_SRC_FILES := $(perf_src_files)
238
239LOCAL_SRC_FILES += \
240	builtin-test.c \
241	bench/mem-memcpy.c \
242	bench/sched-messaging.c \
243	bench/sched-pipe.c \
244	arch/arm/util/dwarf-regs.c
245
246LOCAL_STATIC_LIBRARIES := libperf libdwfl libdw libebl libelf
247
248LOCAL_SHARED_LIBRARIES := libdl
249
250# common
251LOCAL_CFLAGS := -DNO_NEWT_SUPPORT -DNO_LIBPERL -DNO_LIBPYTHON -DNO_STRLCPY -std=gnu99
252
253# in list.h: entry->next = LIST_POISON1;
254LOCAL_CFLAGS += -Wno-pointer-arith
255
256# for __used
257LOCAL_CFLAGS += -include $(LOCAL_PATH)/util/include/linux/compiler.h
258
259# for various GNU extensions
260LOCAL_CFLAGS += -include external/elfutils/bionic-fixup/AndroidFixup.h
261
262# temporary until bfd.h is added
263LOCAL_CFLAGS += -DNO_DEMANGLE
264
265# unique
266LOCAL_CFLAGS += -DPERF_HTML_PATH='""'
267LOCAL_CFLAGS += -DPERF_MAN_PATH='""'
268LOCAL_CFLAGS += -DPERF_INFO_PATH='""'
269LOCAL_CFLAGS += -DPERF_VERSION='"perf.3.0.8_android"'
270
271LOCAL_CFLAGS += -Wno-attributes -Werror
272
273include $(BUILD_EXECUTABLE)
274
275endif #cur_platform
276