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