blob: f8001a45249fc7130deab73585786f36a06f1dba [file] [log] [blame]
Ian Rogers02ed4c02013-09-06 13:10:04 -07001#
2# Copyright (C) 2012 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.mk
20
21LIBART_DISASSEMBLER_SRC_FILES := \
22 disassembler.cc \
23 disassembler_arm.cc \
24 disassembler_mips.cc \
25 disassembler_x86.cc
26
27# $(1): target or host
28# $(2): ndebug or debug
29define build-libart-disassembler
30 ifneq ($(1),target)
31 ifneq ($(1),host)
32 $$(error expected target or host for argument 1, received $(1))
33 endif
34 endif
35 ifneq ($(2),ndebug)
36 ifneq ($(2),debug)
37 $$(error expected ndebug or debug for argument 2, received $(2))
38 endif
39 endif
40
41 art_target_or_host := $(1)
42 art_ndebug_or_debug := $(2)
43
44 include $(CLEAR_VARS)
45 ifeq ($$(art_target_or_host),target)
46 include external/stlport/libstlport.mk
47 else
48 LOCAL_IS_HOST_MODULE := true
49 endif
50 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
51 ifeq ($$(art_ndebug_or_debug),ndebug)
52 LOCAL_MODULE := libart-disassembler
53 else # debug
54 LOCAL_MODULE := libartd-disassembler
55 endif
56
57 LOCAL_MODULE_TAGS := optional
58 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
59
60 LOCAL_SRC_FILES := $$(LIBART_DISASSEMBLER_SRC_FILES)
61
62 GENERATED_SRC_DIR := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),$$(LOCAL_IS_HOST_MODULE),)
63
64 ifeq ($$(art_target_or_host),target)
65 LOCAL_CLANG := $(ART_TARGET_CLANG)
66 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
67 else # host
68 LOCAL_CLANG := $(ART_HOST_CLANG)
69 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
70 endif
71
72 LOCAL_SHARED_LIBRARIES += liblog
73 ifeq ($$(art_ndebug_or_debug),debug)
74 ifeq ($$(art_target_or_host),target)
75 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
76 else # host
77 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
78 endif
79 LOCAL_SHARED_LIBRARIES += libartd
80 else
81 ifeq ($$(art_target_or_host),target)
82 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
83 else # host
84 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
85 endif
86 LOCAL_SHARED_LIBRARIES += libart
87 endif
88
89 LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime
90
91 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk
92 LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
93 ifeq ($$(art_target_or_host),target)
94 LOCAL_SHARED_LIBRARIES += libcutils
95 include $(LLVM_GEN_INTRINSICS_MK)
96 include $(LLVM_DEVICE_BUILD_MK)
97 include $(BUILD_SHARED_LIBRARY)
98 else # host
99 LOCAL_STATIC_LIBRARIES += libcutils
100 include $(LLVM_GEN_INTRINSICS_MK)
101 include $(LLVM_HOST_BUILD_MK)
102 include $(BUILD_HOST_SHARED_LIBRARY)
103 endif
104endef
105
106ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
107 $(eval $(call build-libart-disassembler,target,ndebug))
108endif
109ifeq ($(ART_BUILD_TARGET_DEBUG),true)
110 $(eval $(call build-libart-disassembler,target,debug))
111endif
112ifeq ($(WITH_HOST_DALVIK),true)
113 # We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
114 ifeq ($(ART_BUILD_NDEBUG),true)
115 $(eval $(call build-libart-disassembler,host,ndebug))
116 endif
117 ifeq ($(ART_BUILD_DEBUG),true)
118 $(eval $(call build-libart-disassembler,host,debug))
119 endif
120endif