Home | History | Annotate | Download | only in test
      1 #
      2 # Copyright (C) 2014 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 
     17 LOCAL_PATH := $(call my-dir)
     18 
     19 include art/build/Android.common_build.mk
     20 
     21 LIBNATIVEBRIDGETEST_COMMON_SRC_FILES := \
     22   115-native-bridge/nativebridge.cc
     23 
     24 ART_TARGET_LIBNATIVEBRIDGETEST_$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libnativebridgetest.so
     25 ifdef TARGET_2ND_ARCH
     26   ART_TARGET_LIBNATIVEBRIDGETEST_$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libnativebridgetest.so
     27 endif
     28 
     29 # $(1): target or host
     30 define build-libnativebridgetest
     31   ifneq ($(1),target)
     32     ifneq ($(1),host)
     33       $$(error expected target or host for argument 1, received $(1))
     34     endif
     35   endif
     36 
     37   art_target_or_host := $(1)
     38 
     39   include $(CLEAR_VARS)
     40   LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
     41   LOCAL_MODULE := libnativebridgetest
     42   ifeq ($$(art_target_or_host),target)
     43     LOCAL_MODULE_TAGS := tests
     44   endif
     45   LOCAL_SRC_FILES := $(LIBNATIVEBRIDGETEST_COMMON_SRC_FILES)
     46   LOCAL_SHARED_LIBRARIES += libartd
     47   LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime
     48   LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
     49   LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.libnativebridgetest.mk
     50   ifeq ($$(art_target_or_host),target)
     51     $(call set-target-local-clang-vars)
     52     $(call set-target-local-cflags-vars,debug)
     53     LOCAL_SHARED_LIBRARIES += libdl
     54     LOCAL_STATIC_LIBRARIES := libgtest
     55     LOCAL_MULTILIB := both
     56     LOCAL_MODULE_PATH_32 := $(ART_TARGET_TEST_OUT)/$(ART_TARGET_ARCH_32)
     57     LOCAL_MODULE_PATH_64 := $(ART_TARGET_TEST_OUT)/$(ART_TARGET_ARCH_64)
     58     LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH)
     59     include $(BUILD_SHARED_LIBRARY)
     60   else # host
     61     LOCAL_CLANG := $(ART_HOST_CLANG)
     62     LOCAL_CFLAGS := $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
     63     LOCAL_ASFLAGS := $(ART_HOST_ASFLAGS)
     64     LOCAL_SHARED_LIBRARIES := libcutils
     65     LOCAL_LDLIBS := $(ART_HOST_LDLIBS) -ldl -lpthread
     66     ifeq ($(HOST_OS),linux)
     67       LOCAL_LDLIBS += -lrt
     68     endif
     69     LOCAL_IS_HOST_MODULE := true
     70     LOCAL_MULTILIB := both
     71     include $(BUILD_HOST_SHARED_LIBRARY)
     72   endif
     73 
     74   # Clear locally used variables.
     75   art_target_or_host :=
     76 endef
     77 
     78 ifeq ($(ART_BUILD_TARGET),true)
     79   $(eval $(call build-libnativebridgetest,target))
     80 endif
     81 ifeq ($(ART_BUILD_HOST),true)
     82   $(eval $(call build-libnativebridgetest,host))
     83 endif
     84 
     85 # Clear locally used variables.
     86 LOCAL_PATH :=
     87 LIBNATIVEBRIDGETEST_COMMON_SRC_FILES :=
     88