blob: 5a5f72584f3e5d74261cb6a806680374709b3e7a [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)
Brian Carlstromb4524fd2015-04-02 00:04:09 -070063 LOCAL_SHARED_LIBRARIES := libcutils
Ian Rogers6f3dbba2014-10-14 17:41:57 -070064 LOCAL_LDLIBS := $(ART_HOST_LDLIBS) -ldl -lpthread
Andreas Gampe855564b2014-07-25 02:32:19 -070065 ifeq ($(HOST_OS),linux)
66 LOCAL_LDLIBS += -lrt
67 endif
68 LOCAL_IS_HOST_MODULE := true
69 LOCAL_MULTILIB := both
70 include $(BUILD_HOST_SHARED_LIBRARY)
71 endif
72
73 # Clear locally used variables.
74 art_target_or_host :=
75endef
76
77ifeq ($(ART_BUILD_TARGET),true)
78 $(eval $(call build-libnativebridgetest,target))
79endif
80ifeq ($(ART_BUILD_HOST),true)
81 $(eval $(call build-libnativebridgetest,host))
82endif
83
84# Clear locally used variables.
85LOCAL_PATH :=
86LIBNATIVEBRIDGETEST_COMMON_SRC_FILES :=