Extract bionic-prepare-run-on-host to inc file.
[android-sdk/platform-bionic.git] / benchmarks / Android.mk
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 #
17 ifneq ($(BUILD_TINY_ANDROID), true)
19 LOCAL_PATH := $(call my-dir)
21 # -----------------------------------------------------------------------------
22 # Benchmarks.
23 # -----------------------------------------------------------------------------
25 benchmark_c_flags = \
26     -O2 \
27     -Wall -Wextra -Wunused \
28     -Werror \
29     -fno-builtin \
30     -std=gnu++11 \
32 benchmark_src_files = \
33     benchmark_main.cpp \
34     math_benchmark.cpp \
35     pthread_benchmark.cpp \
36     semaphore_benchmark.cpp \
37     stdio_benchmark.cpp \
38     string_benchmark.cpp \
39     time_benchmark.cpp \
40     unistd_benchmark.cpp \
42 # Build benchmarks for the device (with bionic's .so). Run with:
43 #   adb shell bionic-benchmarks32
44 #   adb shell bionic-benchmarks64
45 include $(CLEAR_VARS)
46 LOCAL_MODULE := bionic-benchmarks
47 LOCAL_MODULE_STEM_32 := bionic-benchmarks32
48 LOCAL_MODULE_STEM_64 := bionic-benchmarks64
49 LOCAL_MULTILIB := both
50 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
51 LOCAL_CFLAGS += $(benchmark_c_flags)
52 LOCAL_SRC_FILES := $(benchmark_src_files) property_benchmark.cpp
53 LOCAL_CXX_STL := libc++
54 include $(BUILD_EXECUTABLE)
56 # We don't build a static benchmark executable because it's not usually
57 # useful. If you're trying to run the current benchmarks on an older
58 # release, it's (so far at least) always because you want to measure the
59 # performance of the old release's libc, and a static benchmark isn't
60 # going to let you do that.
62 # Build benchmarks for the host (against glibc!). Run with:
63 include $(CLEAR_VARS)
64 LOCAL_MODULE := bionic-benchmarks-glibc
65 LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32
66 LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64
67 LOCAL_MULTILIB := both
68 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
69 LOCAL_CFLAGS += $(benchmark_c_flags)
70 LOCAL_LDFLAGS += -lrt
71 LOCAL_SRC_FILES := $(benchmark_src_files)
72 LOCAL_CXX_STL := libc++
73 include $(BUILD_HOST_EXECUTABLE)
75 ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
76 include $(LOCAL_PATH)/../build/run-on-host.mk
78 ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
79 bionic-benchmarks-run-on-host32: bionic-benchmarks bionic-prepare-run-on-host
80         ANDROID_DATA=$(TARGET_OUT_DATA) \
81         ANDROID_ROOT=$(TARGET_OUT) \
82                 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks32 $(BIONIC_BENCHMARKS_FLAGS)
83 endif
85 ifeq ($(TARGET_IS_64_BIT),true)
86 bionic-benchmarks-run-on-host64: bionic-benchmarks bionic-prepare-run-on-host
87         ANDROID_DATA=$(TARGET_OUT_DATA) \
88         ANDROID_ROOT=$(TARGET_OUT) \
89                 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks64 $(BIONIC_BENCHMARKS_FLAGS)
90 endif
92 endif
94 endif # !BUILD_TINY_ANDROID