Android.mk revision 3d594c258045783fc9e1956ce7a4d91e302f011e
1# 2# Copyright (C) 2012 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# ----------------------------------------------------------------------------- 22# Benchmarks. 23# ----------------------------------------------------------------------------- 24 25benchmark_c_flags = \ 26 -O2 \ 27 -Wall -Wextra \ 28 -Werror \ 29 -fno-builtin \ 30 31benchmark_src_files = \ 32 benchmark_main.cpp \ 33 math_benchmark.cpp \ 34 string_benchmark.cpp \ 35 time_benchmark.cpp \ 36 37# Build benchmarks for the device (with bionic's .so). Run with: 38# adb shell bionic-benchmarks 39include $(CLEAR_VARS) 40LOCAL_MODULE := bionic-benchmarks 41LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 42LOCAL_CFLAGS += $(benchmark_c_flags) 43LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include 44LOCAL_SHARED_LIBRARIES += libstlport 45LOCAL_SRC_FILES := $(benchmark_src_files) 46include $(BUILD_EXECUTABLE) 47 48# ----------------------------------------------------------------------------- 49# Unit tests. 50# ----------------------------------------------------------------------------- 51 52test_c_flags = \ 53 -fstack-protector-all \ 54 -g \ 55 -Wall -Wextra \ 56 -Werror \ 57 -fno-builtin \ 58 59test_src_files = \ 60 dirent_test.cpp \ 61 eventfd_test.cpp \ 62 fenv_test.cpp \ 63 fortify1_test.cpp \ 64 fortify2_test.cpp \ 65 getauxval_test.cpp \ 66 getcwd_test.cpp \ 67 libc_logging_test.cpp \ 68 libgen_test.cpp \ 69 malloc_test.cpp \ 70 math_test.cpp \ 71 netdb_test.cpp \ 72 pthread_test.cpp \ 73 regex_test.cpp \ 74 signal_test.cpp \ 75 stack_protector_test.cpp \ 76 stdio_test.cpp \ 77 stdlib_test.cpp \ 78 string_test.cpp \ 79 strings_test.cpp \ 80 stubs_test.cpp \ 81 time_test.cpp \ 82 unistd_test.cpp \ 83 84test_dynamic_ldflags = -Wl,--export-dynamic -Wl,-u,DlSymTestFunction 85test_dynamic_src_files = \ 86 dlfcn_test.cpp \ 87 88# Build tests for the device (with bionic's .so). Run with: 89# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests 90include $(CLEAR_VARS) 91LOCAL_MODULE := bionic-unit-tests 92LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 93LOCAL_CFLAGS += $(test_c_flags) 94LOCAL_LDFLAGS += $(test_dynamic_ldflags) 95LOCAL_SHARED_LIBRARIES += libdl 96LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files) 97include $(BUILD_NATIVE_TEST) 98 99# Build tests for the device (with bionic's .a). Run with: 100# adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static 101include $(CLEAR_VARS) 102LOCAL_MODULE := bionic-unit-tests-static 103LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 104LOCAL_CFLAGS += $(test_c_flags) 105LOCAL_FORCE_STATIC_EXECUTABLE := true 106LOCAL_SRC_FILES := $(test_src_files) 107LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc 108include $(BUILD_NATIVE_TEST) 109 110# ----------------------------------------------------------------------------- 111# Test library for the unit tests. 112# ----------------------------------------------------------------------------- 113 114# Build no-elf-hash-table-library.so to test dlopen(3) on a library that 115# only has a GNU-style hash table. MIPS doesn't support GNU hash style. 116ifneq ($(TARGET_ARCH),mips) 117include $(CLEAR_VARS) 118LOCAL_MODULE := no-elf-hash-table-library 119LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 120LOCAL_SRC_FILES := empty.cpp 121LOCAL_LDFLAGS := -Wl,--hash-style=gnu 122include $(BUILD_SHARED_LIBRARY) 123endif 124 125# ----------------------------------------------------------------------------- 126# Unit tests built against glibc. 127# ----------------------------------------------------------------------------- 128 129# Build tests for the host (with glibc). 130# Note that this will build against glibc, so it's not useful for testing 131# bionic's implementation, but it does let you use glibc as a reference 132# implementation for testing the tests themselves. 133ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) 134include $(CLEAR_VARS) 135LOCAL_MODULE := bionic-unit-tests-glibc 136LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 137LOCAL_CFLAGS += $(test_c_flags) 138LOCAL_LDFLAGS += -lpthread -ldl 139LOCAL_LDFLAGS += $(test_dynamic_ldflags) 140LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files) 141include $(BUILD_HOST_NATIVE_TEST) 142endif 143 144endif # !BUILD_TINY_ANDROID 145