Android.mk revision b6e436eb559cdcf43e21f6617dc0a3d90c7b89b6
1# Copyright (C) 2009 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# 15# Build control file for Bionic's test programs 16# define the BIONIC_TESTS environment variable to build the test programs 17# 18 19# define the ASTL_TESTS environment variable to build the test programs 20ifdef ASTL_TESTS 21 22LOCAL_PATH := $(call my-dir) 23 24# used to define a simple test program and build it as a standalone 25# device executable. 26# 27# you can use EXTRA_CFLAGS to indicate additional CFLAGS to use 28# in the build. the variable will be cleaned on exit 29# 30define device-test 31 $(foreach file,$(1), \ 32 $(eval include $(CLEAR_VARS)) \ 33 $(eval LOCAL_SRC_FILES := $(file)) \ 34 $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ 35 $(eval $(info LOCAL_MODULE=$(LOCAL_MODULE))) \ 36 $(eval LOCAL_CFLAGS += $(EXTRA_CFLAGS)) \ 37 $(eval LOCAL_MODULE_TAGS := tests) \ 38 $(eval LOCAL_STATIC_LIBRARIES := libastl) \ 39 $(eval include $(BUILD_EXECUTABLE)) \ 40 ) \ 41 $(eval EXTRA_CFLAGS :=) 42endef 43 44# same as 'device-test' but builds a host executable instead 45# you can use EXTRA_LDLIBS to indicate additional linker flags 46# 47define host-test 48 $(foreach file,$(1), \ 49 $(eval include $(CLEAR_VARS)) \ 50 $(eval LOCAL_SRC_FILES := $(file)) \ 51 $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ 52 $(eval $(info LOCAL_MODULE=$(LOCAL_MODULE) file=$(file))) \ 53 $(eval LOCAL_CFLAGS += $(EXTRA_CFLAGS)) \ 54 $(eval LOCAL_LDLIBS += $(EXTRA_LDLIBS)) \ 55 $(eval LOCAL_MODULE_TAGS := eng tests) \ 56 $(eval LOCAL_STATIC_LIBRARIES := libastl) \ 57 $(eval include $(BUILD_HOST_EXECUTABLE)) \ 58 ) \ 59 $(eval EXTRA_CFLAGS :=) \ 60 $(eval EXTRA_LDLIBS :=) 61endef 62 63sources := \ 64 test_algorithm.cpp \ 65 test_functional.cpp \ 66 test_ios_base.cpp \ 67 test_ios_pos_types.cpp \ 68 test_iterator.cpp \ 69 test_limits.cpp \ 70 test_set.cpp \ 71 test_string.cpp \ 72 test_type_traits.cpp \ 73 test_uninitialized.cpp \ 74 test_vector.cpp 75 76# Disable all optimization for the host target to help test tools (valgrind...) 77EXTRA_CFLAGS := -I bionic/libstdc++/include -I external/astl/include -g -O0 78$(call host-test, $(sources)) 79 80EXTRA_CFLAGS := -I bionic/libstdc++/include -I external/astl/include 81$(call device-test, $(sources)) 82 83endif #ASTL_TESTS 84