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