blob: d52e6d2102778ecc2a15c5310481c661677d4fdd [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 \
24 src/compiler_llvm/frontend.cc \
25 src/compiler_llvm/generated/art_module.cc \
26 src/compiler_llvm/inferred_reg_category_map.cc \
27 src/compiler_llvm/ir_builder.cc \
28 src/compiler_llvm/jni_compiler.cc \
29 src/compiler_llvm/method_compiler.cc \
TDYa127d668a062012-04-13 12:36:57 -070030 src/compiler_llvm/runtime_support_builder.cc \
31 src/compiler_llvm/runtime_support_builder_arm.cc \
32 src/compiler_llvm/runtime_support_builder_x86.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080033 src/compiler_llvm/runtime_support_llvm.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 \
87 libLLVMMipsCodeGen \
88 libLLVMMipsDesc \
Logan Chien0faf82f2012-03-27 15:12:48 +080089 libLLVMMipsAsmPrinter
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080090
91 libart_compiler_llvm_x86_STATIC_LIBRARIES := \
92 libLLVMX86Info \
93 libLLVMX86AsmParser \
94 libLLVMX86CodeGen \
95 libLLVMX86Disassembler \
96 libLLVMX86Desc \
97 libLLVMX86AsmPrinter \
98 libLLVMX86Utils
99
100 ifeq ($$(art_target_or_host),target)
101 LOCAL_STATIC_LIBRARIES += \
102 $$(libart_compiler_llvm_arm_STATIC_LIBRARIES)
103 else
104 LOCAL_STATIC_LIBRARIES += \
105 $$(libart_compiler_llvm_arm_STATIC_LIBRARIES) \
106 $$(libart_compiler_llvm_mips_STATIC_LIBRARIES) \
107 $$(libart_compiler_llvm_x86_STATIC_LIBRARIES)
108 endif
109
110 LOCAL_STATIC_LIBRARIES += \
111 libLLVMLinker \
112 libLLVMipo \
113 libLLVMBitWriter \
114 libLLVMBitReader \
115 libLLVMAsmPrinter \
116 libLLVMSelectionDAG \
117 libLLVMCodeGen \
Logan Chien0faf82f2012-03-27 15:12:48 +0800118 libLLVMVectorize \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800119 libLLVMScalarOpts \
120 libLLVMInstCombine \
121 libLLVMInstrumentation \
122 libLLVMTransformUtils \
123 libLLVMipa \
124 libLLVMAnalysis \
125 libLLVMTarget \
126 libLLVMMC \
127 libLLVMMCParser \
128 libLLVMCore \
129 libLLVMSupport \
130 librsloader
131 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
132 ifeq ($$(art_target_or_host),target)
133 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
134 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
135 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
136 else # host
137 LOCAL_STATIC_LIBRARIES += libcutils
138 LOCAL_SHARED_LIBRARIES += libz-host
139 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
140 LOCAL_LDLIBS := -ldl -lpthread
141 ifeq ($(HOST_OS),linux)
142 LOCAL_LDLIBS += -lrt
143 endif
144 endif
145 ifeq ($$(art_ndebug_or_debug),debug)
146 ifeq ($$(art_target_or_host),target)
147 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
148 else # host
149 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
150 endif
151 LOCAL_SHARED_LIBRARIES += libartd
152 else
153 ifeq ($$(art_target_or_host),target)
154 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
155 else # host
156 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
157 endif
158 LOCAL_SHARED_LIBRARIES += libart
159 endif
160 ifeq ($$(art_target_or_host),target)
161 include $(LLVM_GEN_INTRINSICS_MK)
162 include $(LLVM_DEVICE_BUILD_MK)
163 include $(BUILD_SHARED_LIBRARY)
164 else # host
165 LOCAL_IS_HOST_MODULE := true
166 include $(LLVM_GEN_INTRINSICS_MK)
167 include $(LLVM_HOST_BUILD_MK)
168 include $(BUILD_HOST_SHARED_LIBRARY)
169 endif
170
171 ifeq ($$(art_target_or_host),target)
172 ifeq ($$(art_ndebug_or_debug),debug)
173 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
174 else
175 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
176 endif
177 else # host
178 ifeq ($$(art_ndebug_or_debug),debug)
179 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
180 else
181 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
182 endif
183 endif
184
185endef
186
187ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700188 $(eval $(call build-libart-compiler-llvm,target,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800189endif
190ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700191 $(eval $(call build-libart-compiler-llvm,target,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800192endif
193ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700194 $(eval $(call build-libart-compiler-llvm,host,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800195endif
196ifeq ($(ART_BUILD_HOST_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700197 $(eval $(call build-libart-compiler-llvm,host,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800198endif