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