blob: 3cbff80969ae10172855d59f06e010f0c42f8a62 [file] [log] [blame]
Shih-wei Liaoc4c98812012-03-10 21:55:51 -08001#
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
17
18LIBART_COMPILER_LLVM_CFLAGS := -DART_USE_LLVM_COMPILER=1
19
20LIBART_COMPILER_LLVM_SRC_FILES += \
21 src/compiler_llvm/compilation_unit.cc \
22 src/compiler_llvm/compiler_llvm.cc \
23 src/compiler_llvm/dalvik_reg.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080024 src/compiler_llvm/generated/art_module.cc \
25 src/compiler_llvm/inferred_reg_category_map.cc \
26 src/compiler_llvm/ir_builder.cc \
27 src/compiler_llvm/jni_compiler.cc \
28 src/compiler_llvm/method_compiler.cc \
TDYa127d668a062012-04-13 12:36:57 -070029 src/compiler_llvm/runtime_support_builder.cc \
30 src/compiler_llvm/runtime_support_builder_arm.cc \
31 src/compiler_llvm/runtime_support_builder_x86.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080032 src/compiler_llvm/runtime_support_llvm.cc \
TDYa127aba61122012-05-04 18:28:36 -070033 src/compiler_llvm/tbaa_info.cc \
Logan Chien937105a2012-04-02 02:37:37 +080034 src/compiler_llvm/upcall_compiler.cc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080035
36# $(1): target or host
37# $(2): ndebug or debug
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080038define build-libart-compiler-llvm
39 ifneq ($(1),target)
40 ifneq ($(1),host)
41 $$(error expected target or host for argument 1, received $(1))
42 endif
43 endif
44 ifneq ($(2),ndebug)
45 ifneq ($(2),debug)
46 $$(error expected ndebug or debug for argument 2, received $(2))
47 endif
48 endif
49
50 art_target_or_host := $(1)
51 art_ndebug_or_debug := $(2)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080052
53 include $(CLEAR_VARS)
54 ifeq ($$(art_target_or_host),target)
55 include external/stlport/libstlport.mk
56 endif
57 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
58 ifeq ($$(art_ndebug_or_debug),ndebug)
59 LOCAL_MODULE := libart-compiler-llvm
60 else # debug
61 LOCAL_MODULE := libartd-compiler-llvm
62 endif
63
64 LOCAL_MODULE_TAGS := optional
65 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
66
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -070067 LOCAL_SRC_FILES := $(LIBART_COMPILER_LLVM_SRC_FILES)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080068 LOCAL_CFLAGS := $(LIBART_COMPILER_LLVM_CFLAGS)
69 ifeq ($$(art_target_or_host),target)
70 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
71 else # host
72 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
73 endif
74
75 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
76 LOCAL_C_INCLUDES += frameworks/compile/linkloader
77 libart_compiler_llvm_arm_STATIC_LIBRARIES := \
78 libLLVMARMInfo \
79 libLLVMARMDisassembler \
80 libLLVMARMAsmParser \
81 libLLVMARMAsmPrinter \
82 libLLVMARMCodeGen \
83 libLLVMARMDesc
84
Shih-wei Liao6e41d422012-03-26 23:43:02 -070085 libart_compiler_llvm_mips_STATIC_LIBRARIES := \
86 libLLVMMipsInfo \
Shih-wei Liao71e85b72012-05-11 01:36:53 -070087 libLLVMMipsDisassembler \
Shih-wei Liao6e41d422012-03-26 23:43:02 -070088 libLLVMMipsCodeGen \
89 libLLVMMipsDesc \
Shih-wei Liao71e85b72012-05-11 01:36:53 -070090 libLLVMMipsAsmParser \
Logan Chien0faf82f2012-03-27 15:12:48 +080091 libLLVMMipsAsmPrinter
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080092
93 libart_compiler_llvm_x86_STATIC_LIBRARIES := \
94 libLLVMX86Info \
95 libLLVMX86AsmParser \
96 libLLVMX86CodeGen \
97 libLLVMX86Disassembler \
98 libLLVMX86Desc \
99 libLLVMX86AsmPrinter \
100 libLLVMX86Utils
101
102 ifeq ($$(art_target_or_host),target)
103 LOCAL_STATIC_LIBRARIES += \
Shih-wei Liao024cf662012-05-28 15:01:28 -0700104 $$(libart_compiler_llvm_$(TARGET_ARCH)_STATIC_LIBRARIES)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800105 else
106 LOCAL_STATIC_LIBRARIES += \
107 $$(libart_compiler_llvm_arm_STATIC_LIBRARIES) \
108 $$(libart_compiler_llvm_mips_STATIC_LIBRARIES) \
109 $$(libart_compiler_llvm_x86_STATIC_LIBRARIES)
110 endif
111
112 LOCAL_STATIC_LIBRARIES += \
113 libLLVMLinker \
114 libLLVMipo \
115 libLLVMBitWriter \
116 libLLVMBitReader \
117 libLLVMAsmPrinter \
118 libLLVMSelectionDAG \
119 libLLVMCodeGen \
Logan Chien0faf82f2012-03-27 15:12:48 +0800120 libLLVMVectorize \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800121 libLLVMScalarOpts \
122 libLLVMInstCombine \
123 libLLVMInstrumentation \
124 libLLVMTransformUtils \
125 libLLVMipa \
126 libLLVMAnalysis \
127 libLLVMTarget \
128 libLLVMMC \
129 libLLVMMCParser \
130 libLLVMCore \
131 libLLVMSupport \
132 librsloader
133 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Elliott Hughes46e251b2012-05-22 15:10:45 -0700134 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800135 ifeq ($$(art_target_or_host),target)
136 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
137 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800138 else # host
139 LOCAL_STATIC_LIBRARIES += libcutils
140 LOCAL_SHARED_LIBRARIES += libz-host
141 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
142 LOCAL_LDLIBS := -ldl -lpthread
143 ifeq ($(HOST_OS),linux)
144 LOCAL_LDLIBS += -lrt
145 endif
146 endif
147 ifeq ($$(art_ndebug_or_debug),debug)
148 ifeq ($$(art_target_or_host),target)
149 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
150 else # host
151 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
152 endif
153 LOCAL_SHARED_LIBRARIES += libartd
154 else
155 ifeq ($$(art_target_or_host),target)
156 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
157 else # host
158 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
159 endif
160 LOCAL_SHARED_LIBRARIES += libart
161 endif
162 ifeq ($$(art_target_or_host),target)
163 include $(LLVM_GEN_INTRINSICS_MK)
164 include $(LLVM_DEVICE_BUILD_MK)
165 include $(BUILD_SHARED_LIBRARY)
166 else # host
167 LOCAL_IS_HOST_MODULE := true
168 include $(LLVM_GEN_INTRINSICS_MK)
169 include $(LLVM_HOST_BUILD_MK)
170 include $(BUILD_HOST_SHARED_LIBRARY)
171 endif
172
173 ifeq ($$(art_target_or_host),target)
174 ifeq ($$(art_ndebug_or_debug),debug)
175 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
176 else
177 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
178 endif
179 else # host
180 ifeq ($$(art_ndebug_or_debug),debug)
181 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
182 else
183 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
184 endif
185 endif
186
187endef
188
189ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700190 $(eval $(call build-libart-compiler-llvm,target,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800191endif
192ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700193 $(eval $(call build-libart-compiler-llvm,target,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800194endif
195ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700196 $(eval $(call build-libart-compiler-llvm,host,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800197endif
198ifeq ($(ART_BUILD_HOST_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700199 $(eval $(call build-libart-compiler-llvm,host,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800200endif