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 | |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 17 | LOCAL_PATH := $(call my-dir) |
| 18 | |
Christopher Ferris | df4942c | 2015-02-17 19:58:53 -0800 | [diff] [blame] | 19 | benchmark_cflags := \ |
| 20 | -O2 \ |
| 21 | -fno-builtin \ |
| 22 | -Wall \ |
| 23 | -Wextra \ |
| 24 | -Werror \ |
| 25 | -Wunused \ |
| 26 | |
| 27 | benchmark_cppflags := \ |
Christopher Ferris | df4942c | 2015-02-17 19:58:53 -0800 | [diff] [blame] | 28 | |
Christopher Ferris | df4942c | 2015-02-17 19:58:53 -0800 | [diff] [blame] | 29 | benchmark_src_files := \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 30 | math_benchmark.cpp \ |
Christopher Ferris | df4942c | 2015-02-17 19:58:53 -0800 | [diff] [blame] | 31 | property_benchmark.cpp \ |
Elliott Hughes | b28e490 | 2014-03-11 11:19:06 -0700 | [diff] [blame] | 32 | pthread_benchmark.cpp \ |
| 33 | semaphore_benchmark.cpp \ |
| 34 | stdio_benchmark.cpp \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 35 | string_benchmark.cpp \ |
| 36 | time_benchmark.cpp \ |
Elliott Hughes | b28e490 | 2014-03-11 11:19:06 -0700 | [diff] [blame] | 37 | unistd_benchmark.cpp \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 38 | |
| 39 | # Build benchmarks for the device (with bionic's .so). Run with: |
Elliott Hughes | 212e0e3 | 2014-12-01 16:43:51 -0800 | [diff] [blame] | 40 | # adb shell bionic-benchmarks32 |
| 41 | # adb shell bionic-benchmarks64 |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 42 | include $(CLEAR_VARS) |
| 43 | LOCAL_MODULE := bionic-benchmarks |
Christopher Ferris | 345b49a | 2014-04-22 10:42:12 -0700 | [diff] [blame] | 44 | LOCAL_MODULE_STEM_32 := bionic-benchmarks32 |
| 45 | LOCAL_MODULE_STEM_64 := bionic-benchmarks64 |
| 46 | LOCAL_MULTILIB := both |
Christopher Ferris | df4942c | 2015-02-17 19:58:53 -0800 | [diff] [blame] | 47 | LOCAL_CFLAGS := $(benchmark_cflags) |
| 48 | LOCAL_CPPFLAGS := $(benchmark_cppflags) |
| 49 | LOCAL_SRC_FILES := $(benchmark_src_files) |
Elliott Hughes | a630784 | 2016-02-17 10:23:52 -0800 | [diff] [blame] | 50 | include $(BUILD_NATIVE_BENCHMARK) |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 51 | |
Elliott Hughes | 212e0e3 | 2014-12-01 16:43:51 -0800 | [diff] [blame] | 52 | # We don't build a static benchmark executable because it's not usually |
| 53 | # useful. If you're trying to run the current benchmarks on an older |
| 54 | # release, it's (so far at least) always because you want to measure the |
| 55 | # performance of the old release's libc, and a static benchmark isn't |
| 56 | # going to let you do that. |
| 57 | |
Christopher Ferris | 941a1a1 | 2015-01-26 16:54:40 -0800 | [diff] [blame] | 58 | # Only supported on linux systems. |
| 59 | ifeq ($(HOST_OS),linux) |
| 60 | |
Elliott Hughes | 212e0e3 | 2014-12-01 16:43:51 -0800 | [diff] [blame] | 61 | # Build benchmarks for the host (against glibc!). Run with: |
| 62 | include $(CLEAR_VARS) |
| 63 | LOCAL_MODULE := bionic-benchmarks-glibc |
| 64 | LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32 |
| 65 | LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64 |
| 66 | LOCAL_MULTILIB := both |
Christopher Ferris | df4942c | 2015-02-17 19:58:53 -0800 | [diff] [blame] | 67 | LOCAL_CFLAGS := $(benchmark_cflags) |
| 68 | LOCAL_CPPFLAGS := $(benchmark_cppflags) |
| 69 | LOCAL_LDFLAGS := -lrt |
Elliott Hughes | 212e0e3 | 2014-12-01 16:43:51 -0800 | [diff] [blame] | 70 | LOCAL_SRC_FILES := $(benchmark_src_files) |
Elliott Hughes | a630784 | 2016-02-17 10:23:52 -0800 | [diff] [blame] | 71 | LOCAL_STATIC_LIBRARIES := libgoogle-benchmark |
| 72 | # TODO: BUILD_HOST_NATIVE_BENCHMARK |
Elliott Hughes | 212e0e3 | 2014-12-01 16:43:51 -0800 | [diff] [blame] | 73 | include $(BUILD_HOST_EXECUTABLE) |
| 74 | |
Christopher Ferris | 941a1a1 | 2015-01-26 16:54:40 -0800 | [diff] [blame] | 75 | endif |
| 76 | |
Elliott Hughes | 625993d | 2014-07-15 16:53:13 -0700 | [diff] [blame] | 77 | ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64)) |
Dmitriy Ivanov | 06b1b8c | 2014-12-02 14:00:13 -0800 | [diff] [blame] | 78 | include $(LOCAL_PATH)/../build/run-on-host.mk |
Christopher Ferris | 3347a79 | 2014-05-01 13:44:57 -0700 | [diff] [blame] | 79 | |
Dmitriy Ivanov | 06b1b8c | 2014-12-02 14:00:13 -0800 | [diff] [blame] | 80 | ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) |
| 81 | bionic-benchmarks-run-on-host32: bionic-benchmarks bionic-prepare-run-on-host |
Christopher Ferris | 3347a79 | 2014-05-01 13:44:57 -0700 | [diff] [blame] | 82 | ANDROID_DATA=$(TARGET_OUT_DATA) \ |
| 83 | ANDROID_ROOT=$(TARGET_OUT) \ |
Dmitriy Ivanov | 06b1b8c | 2014-12-02 14:00:13 -0800 | [diff] [blame] | 84 | $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks32 $(BIONIC_BENCHMARKS_FLAGS) |
| 85 | endif |
| 86 | |
| 87 | ifeq ($(TARGET_IS_64_BIT),true) |
| 88 | bionic-benchmarks-run-on-host64: bionic-benchmarks bionic-prepare-run-on-host |
| 89 | ANDROID_DATA=$(TARGET_OUT_DATA) \ |
| 90 | ANDROID_ROOT=$(TARGET_OUT) \ |
| 91 | $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks64 $(BIONIC_BENCHMARKS_FLAGS) |
| 92 | endif |
| 93 | |
| 94 | endif |