blob: 9ec356aaf9c8613def3a06c9dd4412d9cdad5413 [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)
Logan Chien971bf3f2012-05-01 15:47:55 +080077
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080078 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 += \
Logan Chien971bf3f2012-05-01 15:47:55 +0800114 libLLVMObject \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800115 libLLVMLinker \
116 libLLVMipo \
117 libLLVMBitWriter \
118 libLLVMBitReader \
119 libLLVMAsmPrinter \
120 libLLVMSelectionDAG \
121 libLLVMCodeGen \
Logan Chien0faf82f2012-03-27 15:12:48 +0800122 libLLVMVectorize \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800123 libLLVMScalarOpts \
124 libLLVMInstCombine \
125 libLLVMInstrumentation \
126 libLLVMTransformUtils \
127 libLLVMipa \
128 libLLVMAnalysis \
129 libLLVMTarget \
130 libLLVMMC \
131 libLLVMMCParser \
132 libLLVMCore \
Logan Chien971bf3f2012-05-01 15:47:55 +0800133 libLLVMSupport
134
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800135 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Elliott Hughes46e251b2012-05-22 15:10:45 -0700136 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800137 ifeq ($$(art_target_or_host),target)
138 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
139 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800140 else # host
141 LOCAL_STATIC_LIBRARIES += libcutils
142 LOCAL_SHARED_LIBRARIES += libz-host
143 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
144 LOCAL_LDLIBS := -ldl -lpthread
145 ifeq ($(HOST_OS),linux)
146 LOCAL_LDLIBS += -lrt
147 endif
148 endif
149 ifeq ($$(art_ndebug_or_debug),debug)
150 ifeq ($$(art_target_or_host),target)
151 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
152 else # host
153 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
154 endif
155 LOCAL_SHARED_LIBRARIES += libartd
156 else
157 ifeq ($$(art_target_or_host),target)
158 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
159 else # host
160 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
161 endif
162 LOCAL_SHARED_LIBRARIES += libart
163 endif
164 ifeq ($$(art_target_or_host),target)
165 include $(LLVM_GEN_INTRINSICS_MK)
166 include $(LLVM_DEVICE_BUILD_MK)
167 include $(BUILD_SHARED_LIBRARY)
168 else # host
169 LOCAL_IS_HOST_MODULE := true
170 include $(LLVM_GEN_INTRINSICS_MK)
171 include $(LLVM_HOST_BUILD_MK)
172 include $(BUILD_HOST_SHARED_LIBRARY)
173 endif
174
175 ifeq ($$(art_target_or_host),target)
176 ifeq ($$(art_ndebug_or_debug),debug)
177 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
178 else
179 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
180 endif
181 else # host
182 ifeq ($$(art_ndebug_or_debug),debug)
183 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
184 else
185 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
186 endif
187 endif
188
189endef
190
191ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700192 $(eval $(call build-libart-compiler-llvm,target,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800193endif
194ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700195 $(eval $(call build-libart-compiler-llvm,target,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800196endif
197ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700198 $(eval $(call build-libart-compiler-llvm,host,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800199endif
200ifeq ($(ART_BUILD_HOST_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700201 $(eval $(call build-libart-compiler-llvm,host,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800202endif