]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/blob - benchmarks/Android.mk
f16346339f50d83704f5e45ad2750349d6db29bc
[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 ifeq ($(TARGET_ARCH),x86)
77 LINKER = linker
78 NATIVE_SUFFIX=32
79 else
80 LINKER = linker64
81 NATIVE_SUFFIX=64
82 endif
84 bionic-benchmarks-run-on-host: bionic-benchmarks $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh
85         if [ ! -d /system ]; then \
86           echo "Attempting to create /system"; \
87           sudo mkdir -p -m 0777 /system; \
88         fi
89         mkdir -p $(TARGET_OUT_DATA)/local/tmp
90         ln -fs `realpath $(TARGET_OUT)/bin` /system/
91         ln -fs `realpath $(TARGET_OUT)/etc` /system/
92         ANDROID_DATA=$(TARGET_OUT_DATA) \
93         ANDROID_ROOT=$(TARGET_OUT) \
94         LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \
95                 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks$(NATIVE_SUFFIX) $(BIONIC_BENCHMARKS_FLAGS)
96 endif # linux-x86
98 endif # !BUILD_TINY_ANDROID