Android.libarttest.mk revision 0a112bbbcd761c749c346bfec0ec39c1ef37a590
1#
2# Copyright (C) 2011 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
17LOCAL_PATH := $(call my-dir)
18
19include art/build/Android.common_build.mk
20
21LIBARTTEST_COMMON_SRC_FILES := \
22  004-JniTest/jni_test.cc \
23  004-SignalTest/signaltest.cc \
24  004-ReferenceMap/stack_walk_refmap_jni.cc \
25  004-StackWalk/stack_walk_jni.cc \
26  004-UnsafeTest/unsafe_test.cc \
27  116-nodex2oat/nodex2oat.cc \
28  117-nopatchoat/nopatchoat.cc
29
30ART_TARGET_LIBARTTEST_$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttest.so
31ifdef TARGET_2ND_ARCH
32  ART_TARGET_LIBARTTEST_$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libarttest.so
33endif
34
35# $(1): target or host
36define build-libarttest
37  ifneq ($(1),target)
38    ifneq ($(1),host)
39      $$(error expected target or host for argument 1, received $(1))
40    endif
41  endif
42
43  art_target_or_host := $(1)
44
45  include $(CLEAR_VARS)
46  LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
47  LOCAL_MODULE := libarttest
48  ifeq ($$(art_target_or_host),target)
49    LOCAL_MODULE_TAGS := tests
50  endif
51  LOCAL_SRC_FILES := $(LIBARTTEST_COMMON_SRC_FILES)
52  LOCAL_SHARED_LIBRARIES += libartd
53  LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime
54  LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
55  LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.libarttest.mk
56  include external/libcxx/libcxx.mk
57  ifeq ($$(art_target_or_host),target)
58    $(call set-target-local-clang-vars)
59    $(call set-target-local-cflags-vars,debug)
60    LOCAL_SHARED_LIBRARIES += libdl libcutils
61    LOCAL_STATIC_LIBRARIES := libgtest
62    LOCAL_MULTILIB := both
63    LOCAL_MODULE_PATH_32 := $(ART_TARGET_TEST_OUT)/$(ART_TARGET_ARCH_32)
64    LOCAL_MODULE_PATH_64 := $(ART_TARGET_TEST_OUT)/$(ART_TARGET_ARCH_64)
65    LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH)
66    include $(BUILD_SHARED_LIBRARY)
67  else # host
68    LOCAL_CLANG := $(ART_HOST_CLANG)
69    LOCAL_CFLAGS := $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
70    LOCAL_STATIC_LIBRARIES := libcutils
71    LOCAL_LDLIBS += -ldl -lpthread
72    ifeq ($(HOST_OS),linux)
73      LOCAL_LDLIBS += -lrt
74    endif
75    LOCAL_IS_HOST_MODULE := true
76    LOCAL_MULTILIB := both
77    include $(BUILD_HOST_SHARED_LIBRARY)
78  endif
79
80  # Clear locally used variables.
81  art_target_or_host :=
82endef
83
84ifeq ($(ART_BUILD_TARGET),true)
85  $(eval $(call build-libarttest,target))
86endif
87ifeq ($(ART_BUILD_HOST),true)
88  $(eval $(call build-libarttest,host))
89endif
90
91# Clear locally used variables.
92LOCAL_PATH :=
93LIBARTTEST_COMMON_SRC_FILES :=
94