Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 1 | # |
| 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 | |
| 17 | ifneq ($(BUILD_TINY_ANDROID), true) |
| 18 | |
| 19 | LOCAL_PATH := $(call my-dir) |
| 20 | |
| 21 | # ----------------------------------------------------------------------------- |
| 22 | # Benchmarks. |
| 23 | # ----------------------------------------------------------------------------- |
| 24 | |
| 25 | benchmark_c_flags = \ |
| 26 | -O2 \ |
Elliott Hughes | d286796 | 2014-06-03 15:22:34 -0700 | [diff] [blame] | 27 | -Wall -Wextra -Wunused \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 28 | -Werror \ |
| 29 | -fno-builtin \ |
Serban Constantinescu | 282e232 | 2013-10-22 11:30:12 +0100 | [diff] [blame] | 30 | -std=gnu++11 \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 31 | |
| 32 | benchmark_src_files = \ |
| 33 | benchmark_main.cpp \ |
| 34 | math_benchmark.cpp \ |
| 35 | property_benchmark.cpp \ |
Elliott Hughes | b28e490 | 2014-03-11 11:19:06 -0700 | [diff] [blame] | 36 | pthread_benchmark.cpp \ |
| 37 | semaphore_benchmark.cpp \ |
| 38 | stdio_benchmark.cpp \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 39 | string_benchmark.cpp \ |
| 40 | time_benchmark.cpp \ |
Elliott Hughes | b28e490 | 2014-03-11 11:19:06 -0700 | [diff] [blame] | 41 | unistd_benchmark.cpp \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 42 | |
| 43 | # Build benchmarks for the device (with bionic's .so). Run with: |
| 44 | # adb shell bionic-benchmarks |
| 45 | include $(CLEAR_VARS) |
| 46 | LOCAL_MODULE := bionic-benchmarks |
Christopher Ferris | 345b49a | 2014-04-22 10:42:12 -0700 | [diff] [blame] | 47 | LOCAL_MODULE_STEM_32 := bionic-benchmarks32 |
| 48 | LOCAL_MODULE_STEM_64 := bionic-benchmarks64 |
| 49 | LOCAL_MULTILIB := both |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 50 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 51 | LOCAL_CFLAGS += $(benchmark_c_flags) |
Dan Albert | 7a39094 | 2014-05-19 23:46:51 +0000 | [diff] [blame] | 52 | LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include |
| 53 | LOCAL_SHARED_LIBRARIES += libstlport |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 54 | LOCAL_SRC_FILES := $(benchmark_src_files) |
| 55 | include $(BUILD_EXECUTABLE) |
| 56 | |
Elliott Hughes | 3002131 | 2014-07-15 16:53:13 -0700 | [diff] [blame] | 57 | ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64)) |
Christopher Ferris | 3347a79 | 2014-05-01 13:44:57 -0700 | [diff] [blame] | 58 | ifeq ($(TARGET_ARCH),x86) |
| 59 | LINKER = linker |
| 60 | NATIVE_SUFFIX=32 |
| 61 | else |
| 62 | LINKER = linker64 |
| 63 | NATIVE_SUFFIX=64 |
| 64 | endif |
| 65 | |
| 66 | bionic-benchmarks-run-on-host: bionic-benchmarks $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh |
| 67 | if [ ! -d /system -o ! -d /system/bin ]; then \ |
| 68 | echo "Attempting to create /system/bin"; \ |
| 69 | sudo mkdir -p -m 0777 /system/bin; \ |
| 70 | fi |
| 71 | mkdir -p $(TARGET_OUT_DATA)/local/tmp |
| 72 | cp $(TARGET_OUT_EXECUTABLES)/$(LINKER) /system/bin |
| 73 | cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin |
| 74 | ANDROID_DATA=$(TARGET_OUT_DATA) \ |
| 75 | ANDROID_ROOT=$(TARGET_OUT) \ |
| 76 | LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \ |
| 77 | $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks$(NATIVE_SUFFIX) $(BIONIC_BENCHMARKS_FLAGS) |
| 78 | endif # linux-x86 |
| 79 | |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 80 | endif # !BUILD_TINY_ANDROID |