1# Copyright (C) 2013 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 21endif 22 23cur_platform := $(filter $(HOST_OS),$(supported_platforms)) 24 25ifdef cur_platform 26 27perf_arch := $(TARGET_ARCH) 28ifeq ($(TARGET_ARCH), x86_64) 29perf_arch := x86 30endif 31 32ifeq ($(TARGET_ARCH), mips64) 33perf_arch := mips 34endif 35 36perf_src_files := \ 37 perf.c \ 38 arch/common.c \ 39 arch/$(perf_arch)/util/dwarf-regs.c \ 40 bench/mem-memcpy.c \ 41 bench/mem-memset.c \ 42 bench/sched-messaging.c \ 43 bench/sched-pipe.c \ 44 builtin-annotate.c \ 45 builtin-bench.c \ 46 builtin-buildid-cache.c \ 47 builtin-buildid-list.c \ 48 builtin-diff.c \ 49 builtin-evlist.c \ 50 builtin-help.c \ 51 builtin-inject.c \ 52 builtin-kmem.c \ 53 builtin-kvm.c \ 54 builtin-list.c \ 55 builtin-lock.c \ 56 builtin-mem.c \ 57 builtin-probe.c \ 58 builtin-record.c \ 59 builtin-report.c \ 60 builtin-sched.c \ 61 builtin-script.c \ 62 builtin-stat.c \ 63 builtin-timechart.c \ 64 builtin-top.c \ 65 tests/attr.c \ 66 tests/bp_signal.c \ 67 tests/bp_signal_overflow.c \ 68 tests/builtin-test.c \ 69 tests/code-reading.c \ 70 tests/dso-data.c \ 71 tests/evsel-roundtrip-name.c \ 72 tests/evsel-tp-sched.c \ 73 tests/hists_link.c \ 74 tests/keep-tracking.c \ 75 tests/mmap-basic.c \ 76 tests/open-syscall-all-cpus.c \ 77 tests/open-syscall.c \ 78 tests/open-syscall-tp-fields.c \ 79 tests/parse-events.c \ 80 tests/parse-no-sample-id-all.c \ 81 tests/perf-record.c \ 82 tests/pmu.c \ 83 tests/python-use.c \ 84 tests/rdpmc.c \ 85 tests/sample-parsing.c \ 86 tests/sw-clock.c \ 87 tests/task-exit.c \ 88 tests/vmlinux-kallsyms.c \ 89 ui/helpline.c \ 90 ui/hist.c \ 91 ui/progress.c \ 92 ui/setup.c \ 93 ui/stdio/hist.c \ 94 ui/util.c \ 95 util/abspath.c \ 96 util/alias.c \ 97 util/annotate.c \ 98 util/bitmap.c \ 99 util/build-id.c \ 100 util/callchain.c \ 101 util/cgroup.c \ 102 util/color.c \ 103 util/config.c \ 104 util/cpumap.c \ 105 util/ctype.c \ 106 util/debug.c \ 107 util/dso.c \ 108 util/dwarf-aux.c \ 109 util/environment.c \ 110 util/event.c \ 111 util/evlist.c \ 112 util/evsel.c \ 113 util/exec_cmd.c \ 114 util/header.c \ 115 util/help.c \ 116 util/hist.c \ 117 util/hweight.c \ 118 util/intlist.c \ 119 util/levenshtein.c \ 120 util/machine.c \ 121 util/map.c \ 122 util/pager.c \ 123 util/parse-events.c \ 124 util/parse-events-bison.c \ 125 util/parse-events-flex.c \ 126 util/parse-options.c \ 127 util/path.c \ 128 util/pmu.c \ 129 util/pmu-bison.c \ 130 util/pmu-flex.c \ 131 util/probe-event.c \ 132 util/probe-finder.c \ 133 util/quote.c \ 134 util/rblist.c \ 135 util/record.c \ 136 util/run-command.c \ 137 util/sigchain.c \ 138 util/session.c \ 139 util/sort.c \ 140 util/stat.c \ 141 util/strbuf.c \ 142 util/string.c \ 143 util/strfilter.c \ 144 util/strlist.c \ 145 util/svghelper.c \ 146 util/symbol.c \ 147 util/symbol-elf.c \ 148 util/sysfs.c \ 149 util/target.c \ 150 util/thread.c \ 151 util/thread_map.c \ 152 util/top.c \ 153 util/trace-event-info.c \ 154 util/trace-event-parse.c \ 155 util/trace-event-read.c \ 156 util/trace-event-scripting.c \ 157 util/usage.c \ 158 util/util.c \ 159 util/values.c \ 160 util/vdso.c \ 161 util/wrapper.c \ 162 util/xyarray.c \ 163 ../lib/lk/debugfs.c \ 164 ../lib/traceevent/event-parse.c \ 165 ../lib/traceevent/parse-utils.c \ 166 ../lib/traceevent/trace-seq.c \ 167 ../../lib/rbtree.c 168 169perf_src_files_x86 = \ 170 arch/x86/util/tsc.c \ 171 tests/perf-time-to-tsc.c \ 172 173common_perf_headers := \ 174 $(LOCAL_PATH)/../lib \ 175 $(LOCAL_PATH)/util/include \ 176 $(LOCAL_PATH)/util \ 177 178common_clang_compiler_flags := \ 179 -Wno-int-conversion \ 180 -Wno-tautological-pointer-compare \ 181 -Wno-tautological-constant-out-of-range-compare \ 182 -Wno-pointer-bool-conversion \ 183 184common_compiler_flags := \ 185 -include external/linux-tools-perf/android-fixes.h \ 186 -Wno-error \ 187 -std=gnu99 \ 188 -Wno-attributes \ 189 -Wno-implicit-function-declaration \ 190 -Wno-maybe-uninitialized \ 191 -Wno-missing-field-initializers \ 192 -Wno-pointer-arith \ 193 -Wno-pointer-sign \ 194 -Wno-return-type \ 195 -Wno-sign-compare \ 196 -Wno-unused-parameter \ 197 198common_predefined_macros := \ 199 -D_GNU_SOURCE \ 200 -DDWARF_SUPPORT \ 201 -DPYTHON='""' \ 202 -DPYTHONPATH='""' \ 203 -DBINDIR='""' \ 204 -DETC_PERFCONFIG='""' \ 205 -DPREFIX='""' \ 206 -DPERF_EXEC_PATH='""' \ 207 -DPERF_HTML_PATH='""' \ 208 -DPERF_MAN_PATH='""' \ 209 -DPERF_INFO_PATH='""' \ 210 -DPERF_VERSION='"perf.3.12_android"' \ 211 -DHAVE_ELF_GETPHDRNUM \ 212 -DHAVE_CPLUS_DEMANGLE \ 213 -DHAVE_STRLCPY \ 214 -DLIBELF_SUPPORT \ 215 -DLIBELF_MMAP \ 216 -DNO_NEWT_SUPPORT \ 217 -DNO_LIBPERL \ 218 -DNO_LIBPYTHON \ 219 -DNO_GTK2 \ 220 -DNO_LIBNUMA \ 221 -DNO_LIBAUDIT \ 222 223include $(CLEAR_VARS) 224ifeq ($(TARGET_ARCH),arm) 225# b/17167262, builtin-report.c and builtin-top.c have undefined __aeabi_read_tp 226# when compiled with clang -fpie. 227LOCAL_CLANG := false 228endif 229 230LOCAL_SRC_FILES := $(perf_src_files) 231LOCAL_SRC_FILES_x86 := $(perf_src_files_x86) 232LOCAL_SRC_FILES_x86_64 := $(perf_src_files_x86) 233 234# TODO: this is only needed because of libebl below, which seems like a mistake on the target. 235LOCAL_SHARED_LIBRARIES := libdl 236 237# TODO: there's probably more stuff here than is strictly necessary on the target. 238LOCAL_STATIC_LIBRARIES := \ 239 libdwfl \ 240 libdw \ 241 libdwelf \ 242 libebl \ 243 libelf \ 244 libz \ 245 246LOCAL_CFLAGS += $(common_predefined_macros) 247LOCAL_CFLAGS += $(common_compiler_flags) 248LOCAL_CLANG_CFLAGS += $(common_clang_compiler_flags) 249LOCAL_C_INCLUDES := $(common_perf_headers) external/elfutils/include/ 250 251LOCAL_MODULE := perf 252LOCAL_MODULE_TAGS := eng 253 254include $(BUILD_EXECUTABLE) 255 256endif #cur_platform 257