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