blob: 6f2651ef3771ca8085c6a42166ec93035fd41cf2 [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
Colin Crossbd3efbc2013-11-15 17:49:47 -080017LOCAL_PATH := $(call my-dir)
18
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080019benchmark_cflags := \
20 -O2 \
21 -fno-builtin \
22 -Wall \
23 -Wextra \
24 -Werror \
25 -Wunused \
26
27benchmark_cppflags := \
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080028
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080029benchmark_src_files := \
Colin Crossbd3efbc2013-11-15 17:49:47 -080030 math_benchmark.cpp \
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080031 property_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070032 pthread_benchmark.cpp \
33 semaphore_benchmark.cpp \
34 stdio_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080035 string_benchmark.cpp \
36 time_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070037 unistd_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080038
39# Build benchmarks for the device (with bionic's .so). Run with:
Elliott Hughes212e0e32014-12-01 16:43:51 -080040# adb shell bionic-benchmarks32
41# adb shell bionic-benchmarks64
Colin Crossbd3efbc2013-11-15 17:49:47 -080042include $(CLEAR_VARS)
43LOCAL_MODULE := bionic-benchmarks
Christopher Ferris345b49a2014-04-22 10:42:12 -070044LOCAL_MODULE_STEM_32 := bionic-benchmarks32
45LOCAL_MODULE_STEM_64 := bionic-benchmarks64
46LOCAL_MULTILIB := both
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080047LOCAL_CFLAGS := $(benchmark_cflags)
48LOCAL_CPPFLAGS := $(benchmark_cppflags)
49LOCAL_SRC_FILES := $(benchmark_src_files)
Elliott Hughesa6307842016-02-17 10:23:52 -080050include $(BUILD_NATIVE_BENCHMARK)
Colin Crossbd3efbc2013-11-15 17:49:47 -080051
Elliott Hughes212e0e32014-12-01 16:43:51 -080052# 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 Ferris941a1a12015-01-26 16:54:40 -080058# Only supported on linux systems.
59ifeq ($(HOST_OS),linux)
60
Elliott Hughes212e0e32014-12-01 16:43:51 -080061# Build benchmarks for the host (against glibc!). Run with:
62include $(CLEAR_VARS)
63LOCAL_MODULE := bionic-benchmarks-glibc
64LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32
65LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64
66LOCAL_MULTILIB := both
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080067LOCAL_CFLAGS := $(benchmark_cflags)
68LOCAL_CPPFLAGS := $(benchmark_cppflags)
69LOCAL_LDFLAGS := -lrt
Elliott Hughes212e0e32014-12-01 16:43:51 -080070LOCAL_SRC_FILES := $(benchmark_src_files)
Elliott Hughesa6307842016-02-17 10:23:52 -080071LOCAL_STATIC_LIBRARIES := libgoogle-benchmark
72# TODO: BUILD_HOST_NATIVE_BENCHMARK
Elliott Hughes212e0e32014-12-01 16:43:51 -080073include $(BUILD_HOST_EXECUTABLE)
74
Christopher Ferris941a1a12015-01-26 16:54:40 -080075endif
76
Elliott Hughes625993d2014-07-15 16:53:13 -070077ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -080078include $(LOCAL_PATH)/../build/run-on-host.mk
Christopher Ferris3347a792014-05-01 13:44:57 -070079
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -080080ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
81bionic-benchmarks-run-on-host32: bionic-benchmarks bionic-prepare-run-on-host
Christopher Ferris3347a792014-05-01 13:44:57 -070082 ANDROID_DATA=$(TARGET_OUT_DATA) \
83 ANDROID_ROOT=$(TARGET_OUT) \
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -080084 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks32 $(BIONIC_BENCHMARKS_FLAGS)
85endif
86
87ifeq ($(TARGET_IS_64_BIT),true)
88bionic-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)
92endif
93
94endif