1855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe#
2855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# Copyright (C) 2014 The Android Open Source Project
3855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe#
4855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# Licensed under the Apache License, Version 2.0 (the "License");
5855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# you may not use this file except in compliance with the License.
6855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# You may obtain a copy of the License at
7855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe#
8855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe#      http://www.apache.org/licenses/LICENSE-2.0
9855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe#
10855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# Unless required by applicable law or agreed to in writing, software
11855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# distributed under the License is distributed on an "AS IS" BASIS,
12855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# See the License for the specific language governing permissions and
14855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# limitations under the License.
15855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe#
16855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe
17855564b83db7b106d2995d0e784f1f4b62e52371Andreas GampeLOCAL_PATH := $(call my-dir)
18855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe
19855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampeinclude art/build/Android.common_build.mk
20855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe
21855564b83db7b106d2995d0e784f1f4b62e52371Andreas GampeLIBNATIVEBRIDGETEST_COMMON_SRC_FILES := \
22855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  115-native-bridge/nativebridge.cc
23855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe
24855564b83db7b106d2995d0e784f1f4b62e52371Andreas GampeART_TARGET_LIBNATIVEBRIDGETEST_$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libnativebridgetest.so
25855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampeifdef TARGET_2ND_ARCH
26855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  ART_TARGET_LIBNATIVEBRIDGETEST_$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libnativebridgetest.so
27855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampeendif
28855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe
29855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# $(1): target or host
30855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampedefine build-libnativebridgetest
31855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  ifneq ($(1),target)
32855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    ifneq ($(1),host)
33855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe      $$(error expected target or host for argument 1, received $(1))
34855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    endif
35855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  endif
36855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe
37855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  art_target_or_host := $(1)
38855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe
39855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  include $(CLEAR_VARS)
40855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
41855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  LOCAL_MODULE := libnativebridgetest
42855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  ifeq ($$(art_target_or_host),target)
43855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_MODULE_TAGS := tests
44855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  endif
45855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  LOCAL_SRC_FILES := $(LIBNATIVEBRIDGETEST_COMMON_SRC_FILES)
46855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  LOCAL_SHARED_LIBRARIES += libartd
47855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime
48855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
49855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.libnativebridgetest.mk
50855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  include external/libcxx/libcxx.mk
51855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  ifeq ($$(art_target_or_host),target)
52855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    $(call set-target-local-clang-vars)
53855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    $(call set-target-local-cflags-vars,debug)
54855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_SHARED_LIBRARIES += libdl libcutils
55855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_STATIC_LIBRARIES := libgtest
56855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_MULTILIB := both
57855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_MODULE_PATH_32 := $(ART_TARGET_TEST_OUT)/$(ART_TARGET_ARCH_32)
58855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_MODULE_PATH_64 := $(ART_TARGET_TEST_OUT)/$(ART_TARGET_ARCH_64)
59855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH)
60855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    include $(BUILD_SHARED_LIBRARY)
61855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  else # host
62855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_CLANG := $(ART_HOST_CLANG)
63855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_CFLAGS := $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
64855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_STATIC_LIBRARIES := libcutils
65855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_LDLIBS += -ldl -lpthread
66855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    ifeq ($(HOST_OS),linux)
67855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe      LOCAL_LDLIBS += -lrt
68855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    endif
69855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_IS_HOST_MODULE := true
70855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    LOCAL_MULTILIB := both
71855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe    include $(BUILD_HOST_SHARED_LIBRARY)
72855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  endif
73855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe
74855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  # Clear locally used variables.
75855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  art_target_or_host :=
76855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampeendef
77855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe
78855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampeifeq ($(ART_BUILD_TARGET),true)
79855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  $(eval $(call build-libnativebridgetest,target))
80855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampeendif
81855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampeifeq ($(ART_BUILD_HOST),true)
82855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe  $(eval $(call build-libnativebridgetest,host))
83855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampeendif
84855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe
85855564b83db7b106d2995d0e784f1f4b62e52371Andreas Gampe# Clear locally used variables.
86855564b83db7b106d2995d0e784f1f4b62e52371Andreas GampeLOCAL_PATH :=
87855564b83db7b106d2995d0e784f1f4b62e52371Andreas GampeLIBNATIVEBRIDGETEST_COMMON_SRC_FILES :=
88