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 common/runtime_state.cc \ 23 common/stack_inspect.cc \ 24 004-JniTest/jni_test.cc \ 25 004-SignalTest/signaltest.cc \ 26 004-ReferenceMap/stack_walk_refmap_jni.cc \ 27 004-StackWalk/stack_walk_jni.cc \ 28 004-UnsafeTest/unsafe_test.cc \ 29 044-proxy/native_proxy.cc \ 30 051-thread/thread_test.cc \ 31 117-nopatchoat/nopatchoat.cc \ 32 1337-gc-coverage/gc_coverage.cc \ 33 136-daemon-jni-shutdown/daemon_jni_shutdown.cc \ 34 137-cfi/cfi.cc \ 35 139-register-natives/regnative.cc \ 36 141-class-unload/jni_unload.cc \ 37 148-multithread-gc-annotations/gc_coverage.cc \ 38 454-get-vreg/get_vreg_jni.cc \ 39 457-regs/regs_jni.cc \ 40 461-get-reference-vreg/get_reference_vreg_jni.cc \ 41 466-get-live-vreg/get_live_vreg_jni.cc \ 42 497-inlining-and-class-loader/clear_dex_cache.cc \ 43 543-env-long-ref/env_long_ref.cc \ 44 566-polymorphic-inlining/polymorphic_inline.cc \ 45 570-checker-osr/osr.cc \ 46 595-profile-saving/profile-saving.cc \ 47 596-app-images/app_images.cc \ 48 597-deopt-new-string/deopt.cc 49 50ART_TARGET_LIBARTTEST_$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttest.so 51ART_TARGET_LIBARTTEST_$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttestd.so 52ifdef TARGET_2ND_ARCH 53 ART_TARGET_LIBARTTEST_$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libarttest.so 54 ART_TARGET_LIBARTTEST_$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libarttestd.so 55endif 56 57# $(1): target or host 58define build-libarttest 59 ifneq ($(1),target) 60 ifneq ($(1),host) 61 $$(error expected target or host for argument 1, received $(1)) 62 endif 63 endif 64 ifneq ($(2),debug) 65 ifneq ($(2),) 66 $$(error d or empty for argument 2, received $(2)) 67 endif 68 suffix := d 69 else 70 suffix := 71 endif 72 73 art_target_or_host := $(1) 74 75 include $(CLEAR_VARS) 76 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) 77 LOCAL_MODULE := libarttest$$(suffix) 78 ifeq ($$(art_target_or_host),target) 79 LOCAL_MODULE_TAGS := tests 80 endif 81 LOCAL_SRC_FILES := $(LIBARTTEST_COMMON_SRC_FILES) 82 LOCAL_SHARED_LIBRARIES += libart$$(suffix) libbacktrace libnativehelper 83 LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime 84 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk 85 LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.libarttest.mk 86 ifeq ($$(art_target_or_host),target) 87 $(call set-target-local-clang-vars) 88 $(call set-target-local-cflags-vars,debug) 89 LOCAL_SHARED_LIBRARIES += libdl 90 LOCAL_MULTILIB := both 91 LOCAL_MODULE_PATH_32 := $(ART_TARGET_TEST_OUT)/$(ART_TARGET_ARCH_32) 92 LOCAL_MODULE_PATH_64 := $(ART_TARGET_TEST_OUT)/$(ART_TARGET_ARCH_64) 93 LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH) 94 include $(BUILD_SHARED_LIBRARY) 95 else # host 96 LOCAL_CLANG := $(ART_HOST_CLANG) 97 LOCAL_CFLAGS := $(ART_HOST_CFLAGS) 98 ifeq ($$(suffix),d) 99 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS) 100 else 101 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) 102 endif 103 LOCAL_ASFLAGS := $(ART_HOST_ASFLAGS) 104 LOCAL_LDLIBS := $(ART_HOST_LDLIBS) -ldl -lpthread 105 LOCAL_IS_HOST_MODULE := true 106 LOCAL_MULTILIB := both 107 include $(BUILD_HOST_SHARED_LIBRARY) 108 endif 109 110 # Clear locally used variables. 111 art_target_or_host := 112 suffix := 113endef 114 115ifeq ($(ART_BUILD_TARGET),true) 116 $(eval $(call build-libarttest,target,)) 117 $(eval $(call build-libarttest,target,debug)) 118endif 119ifeq ($(ART_BUILD_HOST),true) 120 $(eval $(call build-libarttest,host,)) 121 $(eval $(call build-libarttest,host,debug)) 122endif 123 124# Clear locally used variables. 125LOCAL_PATH := 126LIBARTTEST_COMMON_SRC_FILES := 127