blob: e1580feb400be29de9dec6ff09dcfc6a6bb760fb [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 := \
32 -std=gnu++11 \
33
34benchmarklib_src_files := \
35 Benchmark.cpp \
36 utils.cpp \
37 main.cpp \
38
Colin Cross7b9df192013-11-15 14:34:22 -080039include $(CLEAR_VARS)
40LOCAL_MODULE := libbenchmark
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080041LOCAL_CFLAGS := $(benchmark_cflags)
42LOCAL_CPPFLAGS := $(benchmark_cppflags)
43LOCAL_SRC_FILES := $(benchmarklib_src_files)
44LOCAL_C_INCLUDES := $(benchmark_c_includes)
Dan Albert4c1dbb42015-03-16 10:06:29 -070045LOCAL_STATIC_LIBRARIES := libbase
Colin Cross7b9df192013-11-15 14:34:22 -080046include $(BUILD_STATIC_LIBRARY)
47
Christopher Ferris941a1a12015-01-26 16:54:40 -080048# Only supported on linux systems.
49ifeq ($(HOST_OS),linux)
50
Colin Cross7b9df192013-11-15 14:34:22 -080051include $(CLEAR_VARS)
52LOCAL_MODULE := libbenchmark
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080053LOCAL_CFLAGS := $(benchmark_cflags)
54LOCAL_CPPFLAGS := $(benchmark_cppflags)
55LOCAL_SRC_FILES := $(benchmarklib_src_files)
56LOCAL_C_INCLUDES := $(benchmark_c_includes)
Colin Cross7b9df192013-11-15 14:34:22 -080057LOCAL_MULTILIB := both
Dan Albert4c1dbb42015-03-16 10:06:29 -070058LOCAL_STATIC_LIBRARIES := libbase
Colin Cross7b9df192013-11-15 14:34:22 -080059include $(BUILD_HOST_STATIC_LIBRARY)
60
Christopher Ferris941a1a12015-01-26 16:54:40 -080061endif
62
Colin Cross7b9df192013-11-15 14:34:22 -080063# -----------------------------------------------------------------------------
Colin Crossbd3efbc2013-11-15 17:49:47 -080064# Benchmarks.
65# -----------------------------------------------------------------------------
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080066benchmark_src_files := \
Colin Crossbd3efbc2013-11-15 17:49:47 -080067 math_benchmark.cpp \
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080068 property_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070069 pthread_benchmark.cpp \
70 semaphore_benchmark.cpp \
71 stdio_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080072 string_benchmark.cpp \
73 time_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070074 unistd_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080075
76# Build benchmarks for the device (with bionic's .so). Run with:
Elliott Hughes212e0e32014-12-01 16:43:51 -080077# adb shell bionic-benchmarks32
78# adb shell bionic-benchmarks64
Colin Crossbd3efbc2013-11-15 17:49:47 -080079include $(CLEAR_VARS)
80LOCAL_MODULE := bionic-benchmarks
Christopher Ferris345b49a2014-04-22 10:42:12 -070081LOCAL_MODULE_STEM_32 := bionic-benchmarks32
82LOCAL_MODULE_STEM_64 := bionic-benchmarks64
83LOCAL_MULTILIB := both
Christopher Ferrisdf4942c2015-02-17 19:58:53 -080084LOCAL_CFLAGS := $(benchmark_cflags)
85LOCAL_CPPFLAGS := $(benchmark_cppflags)
86LOCAL_SRC_FILES := $(benchmark_src_files)
Dan Albert4c1dbb42015-03-16 10:06:29 -070087LOCAL_STATIC_LIBRARIES := libbenchmark libbase
Colin Crossbd3efbc2013-11-15 17:49:47 -080088include $(BUILD_EXECUTABLE)
89
Elliott Hughes212e0e32014-12-01 16:43:51 -080090# We don't build a static benchmark executable because it's not usually
91# useful. If you're trying to run the current benchmarks on an older
92# release, it's (so far at least) always because you want to measure the
93# performance of the old release's libc, and a static benchmark isn't
94# going to let you do that.
95
Christopher Ferris941a1a12015-01-26 16:54:40 -080096# Only supported on linux systems.
97ifeq ($(HOST_OS),linux)
98
Elliott Hughes212e0e32014-12-01 16:43:51 -080099# Build benchmarks for the host (against glibc!). Run with:
100include $(CLEAR_VARS)
101LOCAL_MODULE := bionic-benchmarks-glibc
102LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32
103LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64
104LOCAL_MULTILIB := both
Christopher Ferrisdf4942c2015-02-17 19:58:53 -0800105LOCAL_CFLAGS := $(benchmark_cflags)
106LOCAL_CPPFLAGS := $(benchmark_cppflags)
107LOCAL_LDFLAGS := -lrt
Elliott Hughes212e0e32014-12-01 16:43:51 -0800108LOCAL_SRC_FILES := $(benchmark_src_files)
Dan Albert4c1dbb42015-03-16 10:06:29 -0700109LOCAL_STATIC_LIBRARIES := libbenchmark libbase
Elliott Hughes212e0e32014-12-01 16:43:51 -0800110include $(BUILD_HOST_EXECUTABLE)
111
Christopher Ferris941a1a12015-01-26 16:54:40 -0800112endif
113
Elliott Hughes625993d2014-07-15 16:53:13 -0700114ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -0800115include $(LOCAL_PATH)/../build/run-on-host.mk
Christopher Ferris3347a792014-05-01 13:44:57 -0700116
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -0800117ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
118bionic-benchmarks-run-on-host32: bionic-benchmarks bionic-prepare-run-on-host
Christopher Ferris3347a792014-05-01 13:44:57 -0700119 ANDROID_DATA=$(TARGET_OUT_DATA) \
120 ANDROID_ROOT=$(TARGET_OUT) \
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -0800121 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks32 $(BIONIC_BENCHMARKS_FLAGS)
122endif
123
124ifeq ($(TARGET_IS_64_BIT),true)
125bionic-benchmarks-run-on-host64: bionic-benchmarks bionic-prepare-run-on-host
126 ANDROID_DATA=$(TARGET_OUT_DATA) \
127 ANDROID_ROOT=$(TARGET_OUT) \
128 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks64 $(BIONIC_BENCHMARKS_FLAGS)
129endif
130
131endif