Android.mk revision 59f4ed166997fe0cee1be3970932af1241bd00e3
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
97LOCAL_CFLAGS += -DHAVE_ANDROID_DEMANGLE
98LOCAL_CFLAGS += -DDWARF_SUPPORT
99
100# various macros
101LOCAL_CFLAGS += -DETC_PERFCONFIG='"etc/perfconfig"' \
102                -DPREFIX='""' \
103		-DPERF_EXEC_PATH='"libexec/perf-core"'
104
105# in list.h: entry->next = LIST_POISON1;
106LOCAL_CFLAGS += -Wno-pointer-arith
107
108# for __used
109LOCAL_CFLAGS += -include $(LOCAL_PATH)/util/include/linux/compiler.h
110
111LOCAL_CFLAGS += \
112	-include $(LOCAL_PATH)/host-$(HOST_OS)-fixup/AndroidFixup.h
113
114LOCAL_C_INCLUDES := external/elfutils external/elfutils/libelf external/elfutils/libdw external/elfutils/libdwfl
115
116LOCAL_C_INCLUDES += $(LOCAL_PATH)/host-$(HOST_OS)-fixup
117
118LOCAL_MODULE := libperf
119
120include $(BUILD_HOST_STATIC_LIBRARY)
121
122#
123# target libperf
124#
125
126include $(CLEAR_VARS)
127
128LOCAL_SRC_FILES := $(libperf_src_files)
129
130LOCAL_CFLAGS := -DNO_NEWT_SUPPORT -DNO_LIBPERL -DNO_LIBPYTHON -std=gnu99
131
132LOCAL_CFLAGS += -DHAVE_ANDROID_DEMANGLE
133LOCAL_CFLAGS += -DDWARF_SUPPORT
134
135# various macros
136LOCAL_CFLAGS += -DETC_PERFCONFIG='"etc/perfconfig"' \
137                -DPREFIX='""' \
138		-DPERF_EXEC_PATH='"libexec/perf-core"'
139
140# in list.h: entry->next = LIST_POISON1;
141LOCAL_CFLAGS += -Wno-pointer-arith
142
143# for __used
144LOCAL_CFLAGS += -include $(LOCAL_PATH)/util/include/linux/compiler.h
145
146# for various GNU extensions
147LOCAL_CFLAGS += -include external/elfutils/bionic-fixup/AndroidFixup.h
148
149LOCAL_CFLAGS += -Wno-attributes -Werror
150
151LOCAL_C_INCLUDES := external/elfutils external/elfutils/libelf external/elfutils/libdw external/elfutils/libdwfl
152
153LOCAL_MODULE := libperf
154
155include $(BUILD_STATIC_LIBRARY)
156
157#
158# host perf
159#
160
161include $(CLEAR_VARS)
162
163LOCAL_MODULE := perfhost
164
165perf_src_files := \
166	builtin-annotate.c \
167	builtin-buildid-cache.c \
168	builtin-buildid-list.c \
169	builtin-diff.c \
170	builtin-evlist.c \
171	builtin-help.c \
172	builtin-inject.c \
173	builtin-kmem.c \
174	builtin-kvm.c \
175	builtin-list.c \
176	builtin-lock.c \
177	builtin-probe.c \
178	builtin-record.c \
179	builtin-report.c \
180	builtin-sched.c \
181	builtin-script.c \
182	builtin-stat.c \
183	builtin-timechart.c \
184	builtin-top.c \
185	perf.c
186
187LOCAL_SRC_FILES := $(perf_src_files)
188
189LOCAL_STATIC_LIBRARIES := libperf libdwfl libdw libebl libelf libgccdemangle
190
191LOCAL_LDLIBS := -lpthread -ldl
192
193# for clock_gettime
194ifeq ($(HOST_OS),linux)
195LOCAL_LDLIBS += -lrt
196endif
197
198# common
199LOCAL_CFLAGS := -DNO_NEWT_SUPPORT -DNO_LIBPERL -DNO_LIBPYTHON -DNO_STRLCPY -std=gnu99
200
201LOCAL_CFLAGS += \
202	-include $(LOCAL_PATH)/host-$(HOST_OS)-fixup/AndroidFixup.h
203
204# in list.h: entry->next = LIST_POISON1;
205LOCAL_CFLAGS += -Wno-pointer-arith
206
207# for __used
208LOCAL_CFLAGS += -include $(LOCAL_PATH)/util/include/linux/compiler.h
209
210LOCAL_CFLAGS += -DHAVE_ANDROID_DEMANGLE
211
212# unique
213LOCAL_CFLAGS += -DPERF_HTML_PATH='""'
214LOCAL_CFLAGS += -DPERF_MAN_PATH='""'
215LOCAL_CFLAGS += -DPERF_INFO_PATH='""'
216LOCAL_CFLAGS += -DPERF_VERSION='"perf.3.0.8_android"'
217
218LOCAL_C_INCLUDES += $(LOCAL_PATH)/host-$(HOST_OS)-fixup
219
220include $(BUILD_HOST_EXECUTABLE)
221
222#
223# target perf
224#
225
226include $(CLEAR_VARS)
227
228LOCAL_MODULE := perf
229LOCAL_MODULE_TAGS := eng
230
231LOCAL_SRC_FILES := $(perf_src_files)
232
233LOCAL_SRC_FILES += \
234	builtin-test.c \
235	bench/mem-memcpy.c \
236	bench/sched-messaging.c \
237	bench/sched-pipe.c \
238	arch/arm/util/dwarf-regs.c
239
240LOCAL_STATIC_LIBRARIES := libperf libdwfl libdw libebl libelf libgccdemangle
241
242LOCAL_SHARED_LIBRARIES := libdl
243
244# common
245LOCAL_CFLAGS := -DNO_NEWT_SUPPORT -DNO_LIBPERL -DNO_LIBPYTHON -std=gnu99
246
247# in list.h: entry->next = LIST_POISON1;
248LOCAL_CFLAGS += -Wno-pointer-arith
249
250# for __used
251LOCAL_CFLAGS += -include $(LOCAL_PATH)/util/include/linux/compiler.h
252
253# for various GNU extensions
254LOCAL_CFLAGS += -include external/elfutils/bionic-fixup/AndroidFixup.h
255
256LOCAL_CFLAGS += -DHAVE_ANDROID_DEMANGLE
257
258# unique
259LOCAL_CFLAGS += -DPERF_HTML_PATH='""'
260LOCAL_CFLAGS += -DPERF_MAN_PATH='""'
261LOCAL_CFLAGS += -DPERF_INFO_PATH='""'
262LOCAL_CFLAGS += -DPERF_VERSION='"perf.3.0.8_android"'
263
264LOCAL_CFLAGS += -Wno-attributes -Werror
265
266include $(BUILD_EXECUTABLE)
267
268endif #cur_platform
269