blob: e2c66e446ae3f399365a48e716a5353cc0f673ee [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 \
TDYa127b08ed122012-06-05 23:51:19 -070031 src/compiler_llvm/runtime_support_builder_thumb2.cc \
TDYa127d668a062012-04-13 12:36:57 -070032 src/compiler_llvm/runtime_support_builder_x86.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080033 src/compiler_llvm/runtime_support_llvm.cc \
TDYa127eead4ac2012-06-03 07:15:25 -070034 src/compiler_llvm/stub_compiler.cc \
35 src/compiler_llvm/tbaa_info.cc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080036
37# $(1): target or host
38# $(2): ndebug or debug
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080039define build-libart-compiler-llvm
40 ifneq ($(1),target)
41 ifneq ($(1),host)
42 $$(error expected target or host for argument 1, received $(1))
43 endif
44 endif
45 ifneq ($(2),ndebug)
46 ifneq ($(2),debug)
47 $$(error expected ndebug or debug for argument 2, received $(2))
48 endif
49 endif
50
51 art_target_or_host := $(1)
52 art_ndebug_or_debug := $(2)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080053
54 include $(CLEAR_VARS)
55 ifeq ($$(art_target_or_host),target)
56 include external/stlport/libstlport.mk
57 endif
58 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
59 ifeq ($$(art_ndebug_or_debug),ndebug)
60 LOCAL_MODULE := libart-compiler-llvm
61 else # debug
62 LOCAL_MODULE := libartd-compiler-llvm
63 endif
64
65 LOCAL_MODULE_TAGS := optional
66 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
67
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -070068 LOCAL_SRC_FILES := $(LIBART_COMPILER_LLVM_SRC_FILES)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080069 LOCAL_CFLAGS := $(LIBART_COMPILER_LLVM_CFLAGS)
70 ifeq ($$(art_target_or_host),target)
71 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
72 else # host
73 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
74 endif
75
76 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
77 LOCAL_C_INCLUDES += frameworks/compile/linkloader
78 libart_compiler_llvm_arm_STATIC_LIBRARIES := \
79 libLLVMARMInfo \
80 libLLVMARMDisassembler \
81 libLLVMARMAsmParser \
82 libLLVMARMAsmPrinter \
83 libLLVMARMCodeGen \
84 libLLVMARMDesc
85
Shih-wei Liao6e41d422012-03-26 23:43:02 -070086 libart_compiler_llvm_mips_STATIC_LIBRARIES := \
87 libLLVMMipsInfo \
Shih-wei Liao71e85b72012-05-11 01:36:53 -070088 libLLVMMipsDisassembler \
Shih-wei Liao6e41d422012-03-26 23:43:02 -070089 libLLVMMipsCodeGen \
90 libLLVMMipsDesc \
Shih-wei Liao71e85b72012-05-11 01:36:53 -070091 libLLVMMipsAsmParser \
Logan Chien0faf82f2012-03-27 15:12:48 +080092 libLLVMMipsAsmPrinter
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080093
94 libart_compiler_llvm_x86_STATIC_LIBRARIES := \
95 libLLVMX86Info \
96 libLLVMX86AsmParser \
97 libLLVMX86CodeGen \
98 libLLVMX86Disassembler \
99 libLLVMX86Desc \
100 libLLVMX86AsmPrinter \
101 libLLVMX86Utils
102
103 ifeq ($$(art_target_or_host),target)
104 LOCAL_STATIC_LIBRARIES += \
Shih-wei Liao024cf662012-05-28 15:01:28 -0700105 $$(libart_compiler_llvm_$(TARGET_ARCH)_STATIC_LIBRARIES)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800106 else
107 LOCAL_STATIC_LIBRARIES += \
108 $$(libart_compiler_llvm_arm_STATIC_LIBRARIES) \
109 $$(libart_compiler_llvm_mips_STATIC_LIBRARIES) \
110 $$(libart_compiler_llvm_x86_STATIC_LIBRARIES)
111 endif
112
113 LOCAL_STATIC_LIBRARIES += \
114 libLLVMLinker \
115 libLLVMipo \
116 libLLVMBitWriter \
117 libLLVMBitReader \
118 libLLVMAsmPrinter \
119 libLLVMSelectionDAG \
120 libLLVMCodeGen \
Logan Chien0faf82f2012-03-27 15:12:48 +0800121 libLLVMVectorize \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800122 libLLVMScalarOpts \
123 libLLVMInstCombine \
124 libLLVMInstrumentation \
125 libLLVMTransformUtils \
126 libLLVMipa \
127 libLLVMAnalysis \
128 libLLVMTarget \
129 libLLVMMC \
130 libLLVMMCParser \
131 libLLVMCore \
132 libLLVMSupport \
133 librsloader
134 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Elliott Hughes46e251b2012-05-22 15:10:45 -0700135 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800136 ifeq ($$(art_target_or_host),target)
137 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
138 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800139 else # host
140 LOCAL_STATIC_LIBRARIES += libcutils
141 LOCAL_SHARED_LIBRARIES += libz-host
142 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
143 LOCAL_LDLIBS := -ldl -lpthread
144 ifeq ($(HOST_OS),linux)
145 LOCAL_LDLIBS += -lrt
146 endif
147 endif
148 ifeq ($$(art_ndebug_or_debug),debug)
149 ifeq ($$(art_target_or_host),target)
150 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
151 else # host
152 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
153 endif
154 LOCAL_SHARED_LIBRARIES += libartd
155 else
156 ifeq ($$(art_target_or_host),target)
157 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
158 else # host
159 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
160 endif
161 LOCAL_SHARED_LIBRARIES += libart
162 endif
163 ifeq ($$(art_target_or_host),target)
164 include $(LLVM_GEN_INTRINSICS_MK)
165 include $(LLVM_DEVICE_BUILD_MK)
166 include $(BUILD_SHARED_LIBRARY)
167 else # host
168 LOCAL_IS_HOST_MODULE := true
169 include $(LLVM_GEN_INTRINSICS_MK)
170 include $(LLVM_HOST_BUILD_MK)
171 include $(BUILD_HOST_SHARED_LIBRARY)
172 endif
173
174 ifeq ($$(art_target_or_host),target)
175 ifeq ($$(art_ndebug_or_debug),debug)
176 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
177 else
178 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
179 endif
180 else # host
181 ifeq ($$(art_ndebug_or_debug),debug)
182 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
183 else
184 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
185 endif
186 endif
187
188endef
189
190ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700191 $(eval $(call build-libart-compiler-llvm,target,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800192endif
193ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700194 $(eval $(call build-libart-compiler-llvm,target,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800195endif
196ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700197 $(eval $(call build-libart-compiler-llvm,host,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800198endif
199ifeq ($(ART_BUILD_HOST_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700200 $(eval $(call build-libart-compiler-llvm,host,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800201endif