blob: 8f5fd41fd506968e67616846e944dccf594427e8 [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
17ifneq ($(BUILD_TINY_ANDROID), true)
18
19LOCAL_PATH := $(call my-dir)
20
21# -----------------------------------------------------------------------------
Colin Cross7b9df192013-11-15 14:34:22 -080022# Benchmarks library, usable by projects outside this directory.
23# -----------------------------------------------------------------------------
24
25include $(CLEAR_VARS)
26LOCAL_MODULE := libbenchmark
27LOCAL_CFLAGS += -O2 -Wall -Wextra -Werror
28LOCAL_SRC_FILES := benchmark_main.cpp
29LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
30LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
31include $(BUILD_STATIC_LIBRARY)
32
33include $(CLEAR_VARS)
34LOCAL_MODULE := libbenchmark
35LOCAL_CFLAGS += -O2 -Wall -Wextra -Werror
36LOCAL_SRC_FILES := benchmark_main.cpp
37LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
38LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
39LOCAL_MULTILIB := both
40include $(BUILD_HOST_STATIC_LIBRARY)
41
42# -----------------------------------------------------------------------------
Colin Crossbd3efbc2013-11-15 17:49:47 -080043# Benchmarks.
44# -----------------------------------------------------------------------------
45
46benchmark_c_flags = \
47 -O2 \
Elliott Hughesd2867962014-06-03 15:22:34 -070048 -Wall -Wextra -Wunused \
Colin Crossbd3efbc2013-11-15 17:49:47 -080049 -Werror \
50 -fno-builtin \
Serban Constantinescu282e2322013-10-22 11:30:12 +010051 -std=gnu++11 \
Colin Crossbd3efbc2013-11-15 17:49:47 -080052
53benchmark_src_files = \
Colin Crossbd3efbc2013-11-15 17:49:47 -080054 math_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070055 pthread_benchmark.cpp \
56 semaphore_benchmark.cpp \
57 stdio_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080058 string_benchmark.cpp \
59 time_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070060 unistd_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080061
62# Build benchmarks for the device (with bionic's .so). Run with:
Elliott Hughes212e0e32014-12-01 16:43:51 -080063# adb shell bionic-benchmarks32
64# adb shell bionic-benchmarks64
Colin Crossbd3efbc2013-11-15 17:49:47 -080065include $(CLEAR_VARS)
66LOCAL_MODULE := bionic-benchmarks
Christopher Ferris345b49a2014-04-22 10:42:12 -070067LOCAL_MODULE_STEM_32 := bionic-benchmarks32
68LOCAL_MODULE_STEM_64 := bionic-benchmarks64
69LOCAL_MULTILIB := both
Colin Crossbd3efbc2013-11-15 17:49:47 -080070LOCAL_CFLAGS += $(benchmark_c_flags)
Elliott Hughes212e0e32014-12-01 16:43:51 -080071LOCAL_SRC_FILES := $(benchmark_src_files) property_benchmark.cpp
Colin Cross7b9df192013-11-15 14:34:22 -080072LOCAL_STATIC_LIBRARIES += libbenchmark
Colin Crossbd3efbc2013-11-15 17:49:47 -080073include $(BUILD_EXECUTABLE)
74
Elliott Hughes212e0e32014-12-01 16:43:51 -080075# We don't build a static benchmark executable because it's not usually
76# useful. If you're trying to run the current benchmarks on an older
77# release, it's (so far at least) always because you want to measure the
78# performance of the old release's libc, and a static benchmark isn't
79# going to let you do that.
80
81# Build benchmarks for the host (against glibc!). Run with:
82include $(CLEAR_VARS)
83LOCAL_MODULE := bionic-benchmarks-glibc
84LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32
85LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64
86LOCAL_MULTILIB := both
Elliott Hughes212e0e32014-12-01 16:43:51 -080087LOCAL_CFLAGS += $(benchmark_c_flags)
88LOCAL_LDFLAGS += -lrt
89LOCAL_SRC_FILES := $(benchmark_src_files)
Colin Cross7b9df192013-11-15 14:34:22 -080090LOCAL_STATIC_LIBRARIES += libbenchmark
Elliott Hughes212e0e32014-12-01 16:43:51 -080091include $(BUILD_HOST_EXECUTABLE)
92
Elliott Hughes625993d2014-07-15 16:53:13 -070093ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -080094include $(LOCAL_PATH)/../build/run-on-host.mk
Christopher Ferris3347a792014-05-01 13:44:57 -070095
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -080096ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
97bionic-benchmarks-run-on-host32: bionic-benchmarks bionic-prepare-run-on-host
Christopher Ferris3347a792014-05-01 13:44:57 -070098 ANDROID_DATA=$(TARGET_OUT_DATA) \
99 ANDROID_ROOT=$(TARGET_OUT) \
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -0800100 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks32 $(BIONIC_BENCHMARKS_FLAGS)
101endif
102
103ifeq ($(TARGET_IS_64_BIT),true)
104bionic-benchmarks-run-on-host64: bionic-benchmarks bionic-prepare-run-on-host
105 ANDROID_DATA=$(TARGET_OUT_DATA) \
106 ANDROID_ROOT=$(TARGET_OUT) \
107 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks64 $(BIONIC_BENCHMARKS_FLAGS)
108endif
109
110endif
Christopher Ferris3347a792014-05-01 13:44:57 -0700111
Colin Crossbd3efbc2013-11-15 17:49:47 -0800112endif # !BUILD_TINY_ANDROID