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