blob: dd7255a4c91a9cd4dbfc54b033a2418a97736fda [file] [log] [blame]
Andreas Gampe855564b2014-07-25 02:32:19 -07001#
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
17LOCAL_PATH := $(call my-dir)
18
19include art/build/Android.common_build.mk
20
21LIBNATIVEBRIDGETEST_COMMON_SRC_FILES := \
22 115-native-bridge/nativebridge.cc
23
24ART_TARGET_LIBNATIVEBRIDGETEST_$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libnativebridgetest.so
25ifdef TARGET_2ND_ARCH
26 ART_TARGET_LIBNATIVEBRIDGETEST_$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libnativebridgetest.so
27endif
28
29# $(1): target or host
30define 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 include external/libcxx/libcxx.mk
51 ifeq ($$(art_target_or_host),target)
52 $(call set-target-local-clang-vars)
53 $(call set-target-local-cflags-vars,debug)
54 LOCAL_SHARED_LIBRARIES += libdl libcutils
55 LOCAL_STATIC_LIBRARIES := libgtest
56 LOCAL_MULTILIB := both
57 LOCAL_MODULE_PATH_32 := $(ART_TARGET_TEST_OUT)/$(ART_TARGET_ARCH_32)
58 LOCAL_MODULE_PATH_64 := $(ART_TARGET_TEST_OUT)/$(ART_TARGET_ARCH_64)
59 LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH)
60 include $(BUILD_SHARED_LIBRARY)
61 else # host
62 LOCAL_CLANG := $(ART_HOST_CLANG)
63 LOCAL_CFLAGS := $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
64 LOCAL_STATIC_LIBRARIES := libcutils
65 LOCAL_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 :=
76endef
77
78ifeq ($(ART_BUILD_TARGET),true)
79 $(eval $(call build-libnativebridgetest,target))
80endif
81ifeq ($(ART_BUILD_HOST),true)
82 $(eval $(call build-libnativebridgetest,host))
83endif
84
85# Clear locally used variables.
86LOCAL_PATH :=
87LIBNATIVEBRIDGETEST_COMMON_SRC_FILES :=