blob: d8e0d27fac0f5541d6d459e63e43b671d558f676 [file] [log] [blame]
Colin Crossbd3efbc2013-11-15 17:49:47 -08001#
2# Copyright (C) 2013 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17ifneq ($(BUILD_TINY_ANDROID), true)
18
19LOCAL_PATH := $(call my-dir)
20
21# -----------------------------------------------------------------------------
22# Benchmarks.
23# -----------------------------------------------------------------------------
24
25benchmark_c_flags = \
26 -O2 \
27 -Wall -Wextra \
28 -Werror \
29 -fno-builtin \
Serban Constantinescu282e2322013-10-22 11:30:12 +010030 -std=gnu++11 \
Colin Crossbd3efbc2013-11-15 17:49:47 -080031
32benchmark_src_files = \
33 benchmark_main.cpp \
34 math_benchmark.cpp \
35 property_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070036 pthread_benchmark.cpp \
37 semaphore_benchmark.cpp \
38 stdio_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080039 string_benchmark.cpp \
40 time_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070041 unistd_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080042
43# Build benchmarks for the device (with bionic's .so). Run with:
44# adb shell bionic-benchmarks
45include $(CLEAR_VARS)
46LOCAL_MODULE := bionic-benchmarks
Christopher Ferris345b49a2014-04-22 10:42:12 -070047LOCAL_MODULE_STEM_32 := bionic-benchmarks32
48LOCAL_MODULE_STEM_64 := bionic-benchmarks64
49LOCAL_MULTILIB := both
Colin Crossbd3efbc2013-11-15 17:49:47 -080050LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
51LOCAL_CFLAGS += $(benchmark_c_flags)
Dan Albert4d35da12014-05-19 10:50:15 -070052include external/libcxx/libcxx.mk
Colin Crossbd3efbc2013-11-15 17:49:47 -080053LOCAL_SRC_FILES := $(benchmark_src_files)
54include $(BUILD_EXECUTABLE)
55
Christopher Ferris3347a792014-05-01 13:44:57 -070056ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
57ifeq ($(TARGET_ARCH),x86)
58LINKER = linker
59NATIVE_SUFFIX=32
60else
61LINKER = linker64
62NATIVE_SUFFIX=64
63endif
64
65bionic-benchmarks-run-on-host: bionic-benchmarks $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh
66 if [ ! -d /system -o ! -d /system/bin ]; then \
67 echo "Attempting to create /system/bin"; \
68 sudo mkdir -p -m 0777 /system/bin; \
69 fi
70 mkdir -p $(TARGET_OUT_DATA)/local/tmp
71 cp $(TARGET_OUT_EXECUTABLES)/$(LINKER) /system/bin
72 cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin
73 ANDROID_DATA=$(TARGET_OUT_DATA) \
74 ANDROID_ROOT=$(TARGET_OUT) \
75 LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \
76 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks$(NATIVE_SUFFIX) $(BIONIC_BENCHMARKS_FLAGS)
77endif # linux-x86
78
Colin Crossbd3efbc2013-11-15 17:49:47 -080079endif # !BUILD_TINY_ANDROID