1#
2# Copyright (C) 2015 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
21LIBART_SIMULATOR_SRC_FILES := \
22  code_simulator.cc \
23  code_simulator_arm64.cc
24
25# $(1): target or host
26# $(2): ndebug or debug
27define build-libart-simulator
28  ifneq ($(1),target)
29    ifneq ($(1),host)
30      $$(error expected target or host for argument 1, received $(1))
31    endif
32  endif
33  ifneq ($(2),ndebug)
34    ifneq ($(2),debug)
35      $$(error expected ndebug or debug for argument 2, received $(2))
36    endif
37  endif
38
39  art_target_or_host := $(1)
40  art_ndebug_or_debug := $(2)
41
42  include $(CLEAR_VARS)
43  ifeq ($$(art_target_or_host),host)
44     LOCAL_IS_HOST_MODULE := true
45  endif
46  LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
47  ifeq ($$(art_ndebug_or_debug),ndebug)
48    LOCAL_MODULE := libart-simulator
49  else # debug
50    LOCAL_MODULE := libartd-simulator
51  endif
52
53  LOCAL_MODULE_TAGS := optional
54  LOCAL_MODULE_CLASS := SHARED_LIBRARIES
55
56  LOCAL_SRC_FILES := $$(LIBART_SIMULATOR_SRC_FILES)
57
58  ifeq ($$(art_target_or_host),target)
59    $(call set-target-local-clang-vars)
60    $(call set-target-local-cflags-vars,$(2))
61  else # host
62    LOCAL_CLANG := $(ART_HOST_CLANG)
63    LOCAL_LDLIBS := $(ART_HOST_LDLIBS)
64    LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
65    LOCAL_ASFLAGS += $(ART_HOST_ASFLAGS)
66    ifeq ($$(art_ndebug_or_debug),debug)
67      LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
68    else
69      LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
70    endif
71  endif
72
73  LOCAL_SHARED_LIBRARIES += liblog
74  ifeq ($$(art_ndebug_or_debug),debug)
75    LOCAL_SHARED_LIBRARIES += libartd
76  else
77    LOCAL_SHARED_LIBRARIES += libart
78  endif
79
80  LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime
81  LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
82  LOCAL_MULTILIB := both
83
84  LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
85  LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
86  LOCAL_NATIVE_COVERAGE := $(ART_COVERAGE)
87  # For simulator_arm64.
88  ifeq ($$(art_ndebug_or_debug),debug)
89     LOCAL_SHARED_LIBRARIES += libvixl
90  else
91     LOCAL_SHARED_LIBRARIES += libvixl
92  endif
93  ifeq ($$(art_target_or_host),target)
94    include $(BUILD_SHARED_LIBRARY)
95  else # host
96    include $(BUILD_HOST_SHARED_LIBRARY)
97  endif
98endef
99
100ifeq ($(ART_BUILD_HOST_NDEBUG),true)
101  $(eval $(call build-libart-simulator,host,ndebug))
102endif
103ifeq ($(ART_BUILD_HOST_DEBUG),true)
104  $(eval $(call build-libart-simulator,host,debug))
105endif
106