Android.mk revision cb8eb8e1390d1343563a55c117b5c39cfa87fe1d
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 16# define the ASTL_TESTS environment variable to build the test programs 17ifdef ASTL_TESTS 18 19LOCAL_PATH := $(call my-dir) 20 21# used to define a simple test program and build it as a standalone 22# device executable. 23# 24# you can use EXTRA_CFLAGS to indicate additional CFLAGS to use 25# in the build. the variable will be cleaned on exit 26# 27define device-test 28 $(foreach file,$(1), \ 29 $(eval include $(CLEAR_VARS)) \ 30 $(eval LOCAL_SRC_FILES := $(file)) \ 31 $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ 32 $(eval $(info LOCAL_MODULE=$(LOCAL_MODULE))) \ 33 $(eval LOCAL_CFLAGS += $(EXTRA_CFLAGS)) \ 34 $(eval LOCAL_MODULE_TAGS := tests) \ 35 $(eval LOCAL_STATIC_LIBRARIES := libastl) \ 36 $(eval include $(BUILD_EXECUTABLE)) \ 37 ) \ 38 $(eval EXTRA_CFLAGS :=) 39endef 40 41# same as 'device-test' but builds a host executable instead 42# you can use EXTRA_LDLIBS to indicate additional linker flags 43# 44define host-test 45 $(foreach file,$(1), \ 46 $(eval include $(CLEAR_VARS)) \ 47 $(eval LOCAL_SRC_FILES := $(file)) \ 48 $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ 49 $(eval $(info LOCAL_MODULE=$(LOCAL_MODULE) file=$(file))) \ 50 $(eval LOCAL_CFLAGS += $(EXTRA_CFLAGS)) \ 51 $(eval LOCAL_LDLIBS += $(EXTRA_LDLIBS)) \ 52 $(eval LOCAL_MODULE_TAGS := eng tests) \ 53 $(eval LOCAL_STATIC_LIBRARIES := libastl) \ 54 $(eval include $(BUILD_HOST_EXECUTABLE)) \ 55 ) \ 56 $(eval EXTRA_CFLAGS :=) \ 57 $(eval EXTRA_LDLIBS :=) 58endef 59 60sources := \ 61 test_algorithm.cpp \ 62 test_char_traits.cpp \ 63 test_functional.cpp \ 64 test_ios_base.cpp \ 65 test_iomanip.cpp \ 66 test_ios_pos_types.cpp \ 67 test_iostream.cpp \ 68 test_iterator.cpp \ 69 test_limits.cpp \ 70 test_list.cpp \ 71 test_memory.cpp \ 72 test_set.cpp \ 73 test_sstream.cpp \ 74 test_streambuf.cpp \ 75 test_string.cpp \ 76 test_type_traits.cpp \ 77 test_uninitialized.cpp \ 78 test_vector.cpp 79 80# Disable all optimization for the host target to help test tools (valgrind...) 81EXTRA_CFLAGS := -I bionic/libstdc++/include -I external/astl/include -g -O0 82$(call host-test, $(sources)) 83 84EXTRA_CFLAGS := -I bionic/libstdc++/include -I external/astl/include 85$(call device-test, $(sources)) 86 87endif #ASTL_TESTS 88