85 lines
2.5 KiB
Makefile
85 lines
2.5 KiB
Makefile
|
# Copyright (C) 2009 The Android Open Source Project
|
||
|
#
|
||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
# you may not use this file except in compliance with the License.
|
||
|
# You may obtain a copy of the License at
|
||
|
#
|
||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||
|
#
|
||
|
# Unless required by applicable law or agreed to in writing, software
|
||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
# See the License for the specific language governing permissions and
|
||
|
# limitations under the License.
|
||
|
#
|
||
|
# Build control file for Bionic's test programs
|
||
|
# define the BIONIC_TESTS environment variable to build the test programs
|
||
|
#
|
||
|
|
||
|
ifdef BIONIC_TESTS
|
||
|
|
||
|
LOCAL_PATH:= $(call my-dir)
|
||
|
|
||
|
# used to define a simple test program and build it as a standalone
|
||
|
# device executable.
|
||
|
#
|
||
|
# you can use EXTRA_CFLAGS to indicate additional CFLAGS to use
|
||
|
# in the build. the variable will be cleaned on exit
|
||
|
#
|
||
|
define device-test
|
||
|
$(foreach file,$(1), \
|
||
|
$(eval include $(CLEAR_VARS)) \
|
||
|
$(eval LOCAL_SRC_FILES := $(file)) \
|
||
|
$(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
|
||
|
$(eval LOCAL_CFLAGS += $(EXTRA_CFLAGS)) \
|
||
|
$(eval LOCAL_MODULE_TAGS := tests) \
|
||
|
$(eval include $(BUILD_EXECUTABLE)) \
|
||
|
) \
|
||
|
$(eval EXTRA_CFLAGS :=)
|
||
|
endef
|
||
|
|
||
|
# same as 'device-test' but builds a host executable instead
|
||
|
# you can use EXTRA_LDLIBS to indicate additional linker flags
|
||
|
#
|
||
|
define host-test
|
||
|
$(foreach file,$(1), \
|
||
|
$(eval include $(CLEAR_VARS)) \
|
||
|
$(eval LOCAL_SRC_FILES := $(file)) \
|
||
|
$(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
|
||
|
$(eval LOCAL_CFLAGS += $(EXTRA_CFLAGS)) \
|
||
|
$(eval LOCAL_LDLIBS += $(EXTRA_LDLIBS)) \
|
||
|
$(eval LOCAL_MODULE_TAGS := tests) \
|
||
|
$(eval include $(BUILD_HOST_EXECUTABLE)) \
|
||
|
) \
|
||
|
$(eval EXTRA_CFLAGS :=) \
|
||
|
$(eval EXTRA_LDLIBS :=)
|
||
|
endef
|
||
|
|
||
|
sources := \
|
||
|
test_cassert.cpp \
|
||
|
test_cctype.cpp \
|
||
|
test_climits.cpp \
|
||
|
test_cmath.cpp \
|
||
|
test_csetjmp.cpp \
|
||
|
test_csignal.cpp \
|
||
|
test_cstddef.cpp \
|
||
|
test_cstdio.cpp \
|
||
|
test_cstdlib.cpp \
|
||
|
test_cstring.cpp \
|
||
|
test_ctime.cpp
|
||
|
|
||
|
$(call host-test, $(sources))
|
||
|
|
||
|
EXTRA_CFLAGS := -DBIONIC=1 -I bionic/libstdc++/include
|
||
|
|
||
|
# <cstdint> is not part of the C++ standard yet, and some
|
||
|
# host environments don't provide it unless you use specific
|
||
|
# compiler flags, so only build this test for device/Bionic
|
||
|
# builds at the moment.
|
||
|
#
|
||
|
sources += test_cstdint.cpp
|
||
|
|
||
|
$(call device-test, $(sources))
|
||
|
|
||
|
endif # BIONIC_TESTS
|