Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 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 | |
| 15 | LOCAL_PATH := $(call my-dir) |
| 16 | |
| 17 | ifeq ($(TARGET_PRODUCT),sdk) |
| 18 | supported_platforms := none |
| 19 | else |
Ying Wang | d87efbc | 2014-06-18 16:03:12 -0700 | [diff] [blame] | 20 | supported_platforms := linux darwin |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 21 | endif |
| 22 | |
Ying Wang | d87efbc | 2014-06-18 16:03:12 -0700 | [diff] [blame] | 23 | cur_platform := $(filter $(HOST_OS),$(supported_platforms)) |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 24 | |
| 25 | ifdef cur_platform |
| 26 | |
Fengwei Yin | 5f45339 | 2014-03-13 22:39:41 +0800 | [diff] [blame] | 27 | perf_arch := $(TARGET_ARCH) |
| 28 | ifeq ($(TARGET_ARCH), x86_64) |
| 29 | perf_arch := x86 |
| 30 | endif |
| 31 | |
Raghu Gandham | 37c9bb9 | 2014-04-14 18:24:00 -0700 | [diff] [blame] | 32 | ifeq ($(TARGET_ARCH), mips64) |
| 33 | perf_arch := mips |
| 34 | endif |
| 35 | |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 36 | libperf_src_files := \ |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 37 | arch/common.c \ |
| 38 | arch/$(perf_arch)/util/dwarf-regs.c \ |
| 39 | tests/attr.c \ |
| 40 | ui/helpline.c \ |
| 41 | ui/hist.c \ |
| 42 | ui/progress.c \ |
| 43 | ui/setup.c \ |
| 44 | ui/stdio/hist.c \ |
| 45 | ui/util.c \ |
| 46 | util/abspath.c \ |
| 47 | util/alias.c \ |
| 48 | util/annotate.c \ |
| 49 | util/bitmap.c \ |
| 50 | util/build-id.c \ |
| 51 | util/callchain.c \ |
| 52 | util/cgroup.c \ |
| 53 | util/color.c \ |
| 54 | util/config.c \ |
| 55 | util/cpumap.c \ |
| 56 | util/ctype.c \ |
| 57 | util/debug.c \ |
| 58 | util/dso.c \ |
| 59 | util/dwarf-aux.c \ |
| 60 | util/environment.c \ |
| 61 | util/event.c \ |
| 62 | util/evlist.c \ |
| 63 | util/evsel.c \ |
| 64 | util/exec_cmd.c \ |
| 65 | util/header.c \ |
| 66 | util/help.c \ |
| 67 | util/hist.c \ |
| 68 | util/hweight.c \ |
| 69 | util/intlist.c \ |
| 70 | util/levenshtein.c \ |
| 71 | util/machine.c \ |
| 72 | util/map.c \ |
| 73 | util/pager.c \ |
| 74 | util/parse-events.c \ |
| 75 | util/parse-events-bison.c \ |
| 76 | util/parse-events-flex.c \ |
| 77 | util/parse-options.c \ |
| 78 | util/path.c \ |
| 79 | util/pmu.c \ |
| 80 | util/pmu-bison.c \ |
| 81 | util/pmu-flex.c \ |
| 82 | util/probe-event.c \ |
| 83 | util/probe-finder.c \ |
| 84 | util/quote.c \ |
| 85 | util/rblist.c \ |
| 86 | util/record.c \ |
| 87 | util/run-command.c \ |
| 88 | util/sigchain.c \ |
| 89 | util/session.c \ |
| 90 | util/sort.c \ |
| 91 | util/stat.c \ |
| 92 | util/strbuf.c \ |
| 93 | util/string.c \ |
| 94 | util/strfilter.c \ |
| 95 | util/strlist.c \ |
| 96 | util/svghelper.c \ |
| 97 | util/symbol.c \ |
| 98 | util/symbol-elf.c \ |
| 99 | util/sysfs.c \ |
| 100 | util/target.c \ |
| 101 | util/thread.c \ |
| 102 | util/thread_map.c \ |
| 103 | util/top.c \ |
| 104 | util/trace-event-info.c \ |
| 105 | util/trace-event-parse.c \ |
| 106 | util/trace-event-read.c \ |
| 107 | util/trace-event-scripting.c \ |
| 108 | util/usage.c \ |
| 109 | util/util.c \ |
| 110 | util/values.c \ |
| 111 | util/vdso.c \ |
| 112 | util/wrapper.c \ |
| 113 | util/xyarray.c \ |
| 114 | ../lib/lk/debugfs.c \ |
| 115 | ../lib/traceevent/event-parse.c \ |
| 116 | ../lib/traceevent/parse-utils.c \ |
| 117 | ../lib/traceevent/trace-seq.c \ |
| 118 | ../../lib/rbtree.c |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 119 | |
| 120 | common_perf_headers := $(LOCAL_PATH)/../lib $(LOCAL_PATH)/util/include \ |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 121 | $(LOCAL_PATH)/util $(LOCAL_PATH)/../../include/uapi |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 122 | |
Ben Cheng | 61f9173 | 2013-11-21 15:54:02 -0800 | [diff] [blame] | 123 | common_elfutil_headers := external/elfutils external/elfutils/0.153/libelf \ |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 124 | external/elfutils/0.153/libdw external/elfutils/0.153/libdwfl |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 125 | |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 126 | common_compiler_flags := \ |
Elliott Hughes | d8fa369 | 2014-08-14 14:06:28 -0700 | [diff] [blame] | 127 | -DANDROID_PATCHES \ |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 128 | -Wno-error \ |
| 129 | -std=gnu99 \ |
Elliott Hughes | 41c166c | 2014-08-13 19:28:12 -0700 | [diff] [blame] | 130 | -Wno-return-type \ |
| 131 | |
Elliott Hughes | 35868b6 | 2014-08-14 11:32:34 -0700 | [diff] [blame] | 132 | ifeq ($(strip $(HOST_OS)),linux) |
Elliott Hughes | 41c166c | 2014-08-13 19:28:12 -0700 | [diff] [blame] | 133 | common_compiler_flags += \ |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 134 | -Wno-attributes \ |
| 135 | -Wno-implicit-function-declaration \ |
| 136 | -Wno-int-to-pointer-cast \ |
| 137 | -Wno-maybe-uninitialized \ |
| 138 | -Wno-missing-field-initializers \ |
| 139 | -Wno-pointer-arith \ |
| 140 | -Wno-pointer-sign \ |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 141 | -Wno-sign-compare \ |
| 142 | -Wno-unused-parameter \ |
| 143 | |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 144 | endif |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 145 | |
Elliott Hughes | 35868b6 | 2014-08-14 11:32:34 -0700 | [diff] [blame] | 146 | ifeq ($(strip $(HOST_OS)),darwin) |
| 147 | host_compiler_flags := -include $(LOCAL_PATH)/host-darwin-fixup/AndroidFixup.h |
| 148 | endif |
| 149 | |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 150 | common_disabled_macros := -DNO_NEWT_SUPPORT -DNO_LIBPERL -DNO_LIBPYTHON \ |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 151 | -DNO_GTK2 -DNO_LIBNUMA -DNO_LIBAUDIT |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 152 | |
| 153 | common_predefined_macros := -DDWARF_SUPPORT -DPYTHON='""' -DBINDIR='""' \ |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 154 | -DETC_PERFCONFIG='""' -DPREFIX='""' -DPERF_EXEC_PATH='""' \ |
| 155 | -DPERF_HTML_PATH='""' -DPERF_MAN_PATH='""' -DPERF_INFO_PATH='""' \ |
| 156 | -DPERF_VERSION='"perf.3.12_android"' -DHAVE_ELF_GETPHDRNUM \ |
| 157 | -DLIBELF_SUPPORT -DLIBELF_MMAP |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 158 | |
Elliott Hughes | 35868b6 | 2014-08-14 11:32:34 -0700 | [diff] [blame] | 159 | perf_src_files := \ |
| 160 | perf.c \ |
| 161 | builtin-annotate.c \ |
| 162 | builtin-buildid-cache.c \ |
| 163 | builtin-buildid-list.c \ |
| 164 | builtin-diff.c \ |
| 165 | builtin-evlist.c \ |
| 166 | builtin-help.c \ |
| 167 | builtin-inject.c \ |
| 168 | builtin-kmem.c \ |
| 169 | builtin-list.c \ |
| 170 | builtin-lock.c \ |
| 171 | builtin-mem.c \ |
| 172 | builtin-probe.c \ |
| 173 | builtin-record.c \ |
| 174 | builtin-report.c \ |
| 175 | builtin-sched.c \ |
| 176 | builtin-script.c \ |
| 177 | builtin-stat.c \ |
| 178 | builtin-timechart.c \ |
| 179 | builtin-top.c \ |
| 180 | |
| 181 | |
| 182 | # |
| 183 | # target libperf |
| 184 | # |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 185 | include $(CLEAR_VARS) |
| 186 | |
| 187 | LOCAL_SRC_FILES := $(libperf_src_files) |
| 188 | |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 189 | LOCAL_CFLAGS := $(common_disabled_macros) |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 190 | LOCAL_CFLAGS += $(common_predefined_macros) |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 191 | LOCAL_CFLAGS += $(common_compiler_flags) |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 192 | LOCAL_C_INCLUDES := $(common_perf_headers) $(common_elfutil_headers) |
| 193 | |
| 194 | LOCAL_MODULE := libperf |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 195 | LOCAL_MODULE_TAGS := eng |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 196 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 197 | |
| 198 | include $(BUILD_STATIC_LIBRARY) |
| 199 | |
| 200 | # |
| 201 | # host libperf |
| 202 | # |
| 203 | include $(CLEAR_VARS) |
| 204 | |
| 205 | LOCAL_SRC_FILES := $(libperf_src_files) |
| 206 | |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 207 | LOCAL_CFLAGS := $(common_disabled_macros) |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 208 | LOCAL_CFLAGS += $(common_predefined_macros) |
Elliott Hughes | 35868b6 | 2014-08-14 11:32:34 -0700 | [diff] [blame] | 209 | LOCAL_CFLAGS += $(common_compiler_flags) $(host_compiler_flags) |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 210 | LOCAL_C_INCLUDES := $(common_perf_headers) $(common_elfutil_headers) |
Ben Cheng | 0da4803 | 2013-11-26 15:56:54 -0800 | [diff] [blame] | 211 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/host-$(HOST_OS)-fixup |
| 212 | |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 213 | LOCAL_MODULE := libperf |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 214 | LOCAL_MODULE_TAGS := eng |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 215 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 216 | |
Tim Murray | 20f6b4b | 2014-08-18 13:48:58 -0700 | [diff] [blame] | 217 | LOCAL_CLANG := false |
| 218 | |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 219 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 220 | |
| 221 | # |
| 222 | # target perf |
| 223 | # |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 224 | include $(CLEAR_VARS) |
| 225 | |
| 226 | LOCAL_SRC_FILES := $(perf_src_files) |
| 227 | |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 228 | # TODO: this is only needed because of libebl below, which seems like a mistake on the target. |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 229 | LOCAL_SHARED_LIBRARIES := libdl |
| 230 | |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 231 | # TODO: there's probably more stuff here than is strictly necessary on the target. |
| 232 | LOCAL_STATIC_LIBRARIES := \ |
| 233 | libperf \ |
| 234 | libdwfl \ |
| 235 | libdw \ |
| 236 | libebl \ |
| 237 | libelf \ |
| 238 | libgccdemangle \ |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 239 | |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 240 | LOCAL_CFLAGS := $(common_disabled_macros) |
| 241 | LOCAL_CFLAGS += $(common_predefined_macros) |
| 242 | LOCAL_CFLAGS += $(common_compiler_flags) |
| 243 | LOCAL_C_INCLUDES := $(common_perf_headers) $(common_elfutil_headers) |
| 244 | |
| 245 | LOCAL_MODULE := perf |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 246 | LOCAL_MODULE_TAGS := eng |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 247 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 248 | |
| 249 | include $(BUILD_EXECUTABLE) |
| 250 | |
| 251 | # |
| 252 | # host perf |
| 253 | # |
| 254 | include $(CLEAR_VARS) |
| 255 | |
| 256 | LOCAL_SRC_FILES := $(perf_src_files) |
| 257 | |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 258 | # TODO: libebl tries to dlopen libebl_$arch.so, which we don't actually build. |
| 259 | # At the moment it's probably pulling in the ones from the host OS' perf, at |
| 260 | # least on Linux. On the Mac it's probably just completely broken. |
| 261 | LOCAL_STATIC_LIBRARIES := \ |
| 262 | libperf \ |
| 263 | libdwfl \ |
| 264 | libdw \ |
| 265 | libebl \ |
| 266 | libelf \ |
| 267 | libgccdemangle \ |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 268 | |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 269 | LOCAL_CFLAGS := $(common_disabled_macros) |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 270 | LOCAL_CFLAGS += $(common_predefined_macros) |
Elliott Hughes | 35868b6 | 2014-08-14 11:32:34 -0700 | [diff] [blame] | 271 | LOCAL_CFLAGS += $(common_compiler_flags) $(host_compiler_flags) |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 272 | |
Ben Cheng | 0da4803 | 2013-11-26 15:56:54 -0800 | [diff] [blame] | 273 | # available on linux-x86 but not darwin-x86 |
| 274 | ifeq ($(strip $(HOST_OS)),linux) |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 275 | LOCAL_CFLAGS += -DHAVE_ON_EXIT |
Ben Cheng | 0da4803 | 2013-11-26 15:56:54 -0800 | [diff] [blame] | 276 | endif |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 277 | |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 278 | LOCAL_C_INCLUDES := $(common_perf_headers) $(common_elfutil_headers) |
Ben Cheng | 0da4803 | 2013-11-26 15:56:54 -0800 | [diff] [blame] | 279 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/host-$(HOST_OS)-fixup |
| 280 | |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 281 | # for pthread_* and clock_gettime |
Ben Cheng | 0da4803 | 2013-11-26 15:56:54 -0800 | [diff] [blame] | 282 | LOCAL_LDLIBS := -lpthread -ldl |
| 283 | |
| 284 | ifeq ($(strip $(HOST_OS)),linux) |
| 285 | LOCAL_LDLIBS += -lrt |
| 286 | endif |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 287 | |
| 288 | LOCAL_MODULE := perfhost |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 289 | LOCAL_MODULE_TAGS := eng |
Elliott Hughes | 708e65a | 2014-08-13 13:13:02 -0700 | [diff] [blame] | 290 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 291 | |
Tim Murray | 20f6b4b | 2014-08-18 13:48:58 -0700 | [diff] [blame] | 292 | LOCAL_CLANG := false |
| 293 | |
Ben Cheng | f305579 | 2013-11-19 15:38:08 -0800 | [diff] [blame] | 294 | include $(BUILD_HOST_EXECUTABLE) |
| 295 | |
| 296 | endif #cur_platform |