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