blob: e8cc7e45cef27d93a914a6e47ee2c024cbb2e6db [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
Andreas Gampe855564b2014-07-25 02:32:19 -070050 ifeq ($$(art_target_or_host),target)
51 $(call set-target-local-clang-vars)
52 $(call set-target-local-cflags-vars,debug)
Ian Rogerscf7f1912014-10-22 22:06:39 -070053 LOCAL_SHARED_LIBRARIES += libdl
Andreas Gampe855564b2014-07-25 02:32:19 -070054 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)
Roland Levillain12bd7212015-06-04 17:50:27 +010063 LOCAL_ASFLAGS := $(ART_HOST_ASFLAGS)
Brian Carlstromb4524fd2015-04-02 00:04:09 -070064 LOCAL_SHARED_LIBRARIES := libcutils
Ian Rogers6f3dbba2014-10-14 17:41:57 -070065 LOCAL_LDLIBS := $(ART_HOST_LDLIBS) -ldl -lpthread
Andreas Gampe855564b2014-07-25 02:32:19 -070066 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 :=