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