aboutsummaryrefslogtreecommitdiff
path: root/src/tools/perf/Android.mk
blob: 0b812314c8324ca5a79d5f2b4b6a06c74f1275f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# Copyright (C) 2013 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH := $(call my-dir)

ifeq ($(TARGET_PRODUCT),sdk)
supported_platforms := none
else
supported_platforms := linux
endif

cur_platform := $(filter $(HOST_OS),$(supported_platforms))

ifdef cur_platform

perf_arch := $(TARGET_ARCH)
ifeq ($(TARGET_ARCH), x86_64)
perf_arch := x86
endif

ifeq ($(TARGET_ARCH), mips64)
perf_arch := mips
endif

perf_src_files := \
    perf.c \
    arch/common.c \
    arch/$(perf_arch)/util/dwarf-regs.c \
    bench/mem-memcpy.c \
    bench/mem-memset.c \
    bench/sched-messaging.c \
    bench/sched-pipe.c \
    builtin-annotate.c \
    builtin-bench.c \
    builtin-buildid-cache.c \
    builtin-buildid-list.c \
    builtin-diff.c \
    builtin-evlist.c \
    builtin-help.c \
    builtin-inject.c \
    builtin-kmem.c \
    builtin-kvm.c \
    builtin-list.c \
    builtin-lock.c \
    builtin-mem.c \
    builtin-probe.c \
    builtin-record.c \
    builtin-report.c \
    builtin-sched.c \
    builtin-script.c \
    builtin-stat.c \
    builtin-timechart.c \
    builtin-top.c \
    tests/attr.c \
    tests/bp_signal.c \
    tests/bp_signal_overflow.c \
    tests/builtin-test.c \
    tests/code-reading.c \
    tests/dso-data.c \
    tests/evsel-roundtrip-name.c \
    tests/evsel-tp-sched.c \
    tests/hists_link.c \
    tests/keep-tracking.c \
    tests/mmap-basic.c \
    tests/open-syscall-all-cpus.c \
    tests/open-syscall.c \
    tests/open-syscall-tp-fields.c \
    tests/parse-events.c \
    tests/parse-no-sample-id-all.c \
    tests/perf-record.c \
    tests/pmu.c \
    tests/python-use.c \
    tests/rdpmc.c \
    tests/sample-parsing.c \
    tests/sw-clock.c \
    tests/task-exit.c \
    tests/vmlinux-kallsyms.c \
    ui/helpline.c \
    ui/hist.c \
    ui/progress.c \
    ui/setup.c \
    ui/stdio/hist.c \
    ui/util.c \
    util/abspath.c \
    util/alias.c \
    util/annotate.c \
    util/bitmap.c \
    util/build-id.c \
    util/callchain.c \
    util/cgroup.c \
    util/color.c \
    util/config.c \
    util/cpumap.c \
    util/ctype.c \
    util/debug.c \
    util/dso.c \
    util/dwarf-aux.c \
    util/environment.c \
    util/event.c \
    util/evlist.c \
    util/evsel.c \
    util/exec_cmd.c \
    util/header.c \
    util/help.c \
    util/hist.c \
    util/hweight.c \
    util/intlist.c \
    util/levenshtein.c \
    util/machine.c \
    util/map.c \
    util/pager.c \
    util/parse-events.c \
    util/parse-events-bison.c \
    util/parse-events-flex.c \
    util/parse-options.c \
    util/path.c \
    util/pmu.c \
    util/pmu-bison.c \
    util/pmu-flex.c \
    util/probe-event.c \
    util/probe-finder.c \
    util/quote.c \
    util/rblist.c \
    util/record.c \
    util/run-command.c \
    util/sigchain.c \
    util/session.c \
    util/sort.c \
    util/stat.c \
    util/strbuf.c \
    util/string.c \
    util/strfilter.c \
    util/strlist.c \
    util/svghelper.c \
    util/symbol.c \
    util/symbol-elf.c \
    util/sysfs.c \
    util/target.c \
    util/thread.c \
    util/thread_map.c \
    util/top.c \
    util/trace-event-info.c \
    util/trace-event-parse.c \
    util/trace-event-read.c \
    util/trace-event-scripting.c \
    util/usage.c \
    util/util.c \
    util/values.c \
    util/vdso.c \
    util/wrapper.c \
    util/xyarray.c \
    ../lib/lk/debugfs.c \
    ../lib/traceevent/event-parse.c \
    ../lib/traceevent/parse-utils.c \
    ../lib/traceevent/trace-seq.c \
    ../../lib/rbtree.c

perf_src_files_x86 = \
    arch/x86/util/tsc.c \
    tests/perf-time-to-tsc.c \

common_perf_headers := \
    $(LOCAL_PATH)/../lib \
    $(LOCAL_PATH)/util/include \
    $(LOCAL_PATH)/util \

common_clang_compiler_flags := \
    -Wno-int-conversion \
    -Wno-tautological-pointer-compare \
    -Wno-tautological-constant-out-of-range-compare \
    -Wno-pointer-bool-conversion \

common_compiler_flags := \
    -include external/linux-tools-perf/android-fixes.h \
    -Wno-error \
    -std=gnu99 \
    -Wno-attributes \
    -Wno-implicit-function-declaration \
    -Wno-maybe-uninitialized \
    -Wno-missing-field-initializers \
    -Wno-pointer-arith \
    -Wno-pointer-sign \
    -Wno-return-type \
    -Wno-sign-compare \
    -Wno-unused-parameter \

common_predefined_macros := \
    -D_GNU_SOURCE \
    -DDWARF_SUPPORT \
    -DPYTHON='""' \
    -DPYTHONPATH='""' \
    -DBINDIR='""' \
    -DETC_PERFCONFIG='""' \
    -DPREFIX='""' \
    -DPERF_EXEC_PATH='""' \
    -DPERF_HTML_PATH='""' \
    -DPERF_MAN_PATH='""' \
    -DPERF_INFO_PATH='""' \
    -DPERF_VERSION='"perf.3.12_android"' \
    -DHAVE_ELF_GETPHDRNUM \
    -DHAVE_CPLUS_DEMANGLE \
    -DHAVE_STRLCPY \
    -DLIBELF_SUPPORT \
    -DLIBELF_MMAP \
    -DNO_NEWT_SUPPORT \
    -DNO_LIBPERL \
    -DNO_LIBPYTHON \
    -DNO_GTK2 \
    -DNO_LIBNUMA \
    -DNO_LIBAUDIT \

include $(CLEAR_VARS)

# b/17167262, builtin-report.c and builtin-top.c have undefined __aeabi_read_tp
# when compiled with clang -fpie.
#
# Aside from that, this code is not -Wreturn-type safe. Rather than rewriting
# the bison generated code, just use GCC.
LOCAL_CLANG := false

LOCAL_SRC_FILES := $(perf_src_files)
LOCAL_SRC_FILES_x86 := $(perf_src_files_x86)
LOCAL_SRC_FILES_x86_64 := $(perf_src_files_x86)

# TODO: this is only needed because of libebl below, which seems like a mistake on the target.
LOCAL_SHARED_LIBRARIES := libdl

# TODO: there's probably more stuff here than is strictly necessary on the target.
LOCAL_STATIC_LIBRARIES := \
    libdwfl \
    libdw \
    libdwelf \
    libebl \
    libelf \
    libz \

LOCAL_CFLAGS += $(common_predefined_macros)
LOCAL_CFLAGS += $(common_compiler_flags)
LOCAL_CLANG_CFLAGS += $(common_clang_compiler_flags)
LOCAL_C_INCLUDES := $(common_perf_headers) external/elfutils/include/

LOCAL_MODULE := perf
LOCAL_MODULE_TAGS := eng

include $(BUILD_EXECUTABLE)

endif #cur_platform