blob: 20742bdc083efd99191ba91f2efa5bdf24b461e8 [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
19# -----------------------------------------------------------------------------
Colin Cross7b9df192013-11-15 14:34:22 -080020# Benchmarks library, usable by projects outside this directory.
21# -----------------------------------------------------------------------------
22
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080023benchmark_cflags := \
24 -O2 \
25 -fno-builtin \
26 -Wall \
27 -Wextra \
28 -Werror \
29 -Wunused \
30
31benchmark_cppflags := \
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080032
33benchmarklib_src_files := \
34 Benchmark.cpp \
35 utils.cpp \
36 main.cpp \
37
Colin Cross7b9df192013-11-15 14:34:22 -080038include $(CLEAR_VARS)
39LOCAL_MODULE := libbenchmark
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080040LOCAL_CFLAGS := $(benchmark_cflags)
41LOCAL_CPPFLAGS := $(benchmark_cppflags)
42LOCAL_SRC_FILES := $(benchmarklib_src_files)
43LOCAL_C_INCLUDES := $(benchmark_c_includes)
Dan Albert3e87c782015-03-16 10:06:29 -070044LOCAL_STATIC_LIBRARIES := libbase
Colin Cross7b9df192013-11-15 14:34:22 -080045include $(BUILD_STATIC_LIBRARY)
46
Christopher Ferris941a1a12015-01-26 16:54:40 -080047# Only supported on linux systems.
48ifeq ($(HOST_OS),linux)
49
Colin Cross7b9df192013-11-15 14:34:22 -080050include $(CLEAR_VARS)
51LOCAL_MODULE := libbenchmark
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080052LOCAL_CFLAGS := $(benchmark_cflags)
53LOCAL_CPPFLAGS := $(benchmark_cppflags)
54LOCAL_SRC_FILES := $(benchmarklib_src_files)
55LOCAL_C_INCLUDES := $(benchmark_c_includes)
Colin Cross7b9df192013-11-15 14:34:22 -080056LOCAL_MULTILIB := both
Dan Albert3e87c782015-03-16 10:06:29 -070057LOCAL_STATIC_LIBRARIES := libbase
Colin Cross7b9df192013-11-15 14:34:22 -080058include $(BUILD_HOST_STATIC_LIBRARY)
59
Christopher Ferris941a1a12015-01-26 16:54:40 -080060endif
61
Colin Cross7b9df192013-11-15 14:34:22 -080062# -----------------------------------------------------------------------------
Colin Crossbd3efbc2013-11-15 17:49:47 -080063# Benchmarks.
64# -----------------------------------------------------------------------------
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080065benchmark_src_files := \
Colin Crossbd3efbc2013-11-15 17:49:47 -080066 math_benchmark.cpp \
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080067 property_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070068 pthread_benchmark.cpp \
69 semaphore_benchmark.cpp \
70 stdio_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080071 string_benchmark.cpp \
72 time_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070073 unistd_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080074
75# Build benchmarks for the device (with bionic's .so). Run with:
Elliott Hughes212e0e32014-12-01 16:43:51 -080076# adb shell bionic-benchmarks32
77# adb shell bionic-benchmarks64
Colin Crossbd3efbc2013-11-15 17:49:47 -080078include $(CLEAR_VARS)
79LOCAL_MODULE := bionic-benchmarks
Christopher Ferris345b49a2014-04-22 10:42:12 -070080LOCAL_MODULE_STEM_32 := bionic-benchmarks32
81LOCAL_MODULE_STEM_64 := bionic-benchmarks64
82LOCAL_MULTILIB := both
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080083LOCAL_CFLAGS := $(benchmark_cflags)
84LOCAL_CPPFLAGS := $(benchmark_cppflags)
85LOCAL_SRC_FILES := $(benchmark_src_files)
Dan Albert3e87c782015-03-16 10:06:29 -070086LOCAL_STATIC_LIBRARIES := libbenchmark libbase
Colin Crossbd3efbc2013-11-15 17:49:47 -080087include $(BUILD_EXECUTABLE)
88
Elliott Hughes212e0e32014-12-01 16:43:51 -080089# We don't build a static benchmark executable because it's not usually
90# useful. If you're trying to run the current benchmarks on an older
91# release, it's (so far at least) always because you want to measure the
92# performance of the old release's libc, and a static benchmark isn't
93# going to let you do that.
94
Christopher Ferris941a1a12015-01-26 16:54:40 -080095# Only supported on linux systems.
96ifeq ($(HOST_OS),linux)
97
Elliott Hughes212e0e32014-12-01 16:43:51 -080098# Build benchmarks for the host (against glibc!). Run with:
99include $(CLEAR_VARS)
100LOCAL_MODULE := bionic-benchmarks-glibc
101LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32
102LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64
103LOCAL_MULTILIB := both
Christopher Ferrisdf4942c2015-02-17 19:58:53 -0800104LOCAL_CFLAGS := $(benchmark_cflags)
105LOCAL_CPPFLAGS := $(benchmark_cppflags)
106LOCAL_LDFLAGS := -lrt
Elliott Hughes212e0e32014-12-01 16:43:51 -0800107LOCAL_SRC_FILES := $(benchmark_src_files)
Dan Albert3e87c782015-03-16 10:06:29 -0700108LOCAL_STATIC_LIBRARIES := libbenchmark libbase
Elliott Hughes212e0e32014-12-01 16:43:51 -0800109include $(BUILD_HOST_EXECUTABLE)
110
Christopher Ferris941a1a12015-01-26 16:54:40 -0800111endif
112
Elliott Hughes625993d2014-07-15 16:53:13 -0700113ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -0800114include $(LOCAL_PATH)/../build/run-on-host.mk
Christopher Ferris3347a792014-05-01 13:44:57 -0700115
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -0800116ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
117bionic-benchmarks-run-on-host32: bionic-benchmarks bionic-prepare-run-on-host
Christopher Ferris3347a792014-05-01 13:44:57 -0700118 ANDROID_DATA=$(TARGET_OUT_DATA) \
119 ANDROID_ROOT=$(TARGET_OUT) \
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -0800120 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks32 $(BIONIC_BENCHMARKS_FLAGS)
121endif
122
123ifeq ($(TARGET_IS_64_BIT),true)
124bionic-benchmarks-run-on-host64: bionic-benchmarks bionic-prepare-run-on-host
125 ANDROID_DATA=$(TARGET_OUT_DATA) \
126 ANDROID_ROOT=$(TARGET_OUT) \
127 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks64 $(BIONIC_BENCHMARKS_FLAGS)
128endif
129
130endif