blob: c8c091eaa28f1a0d3a10f6c35f5c5eae4105bf03 [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 \
30 src/compiler_llvm/runtime_support_llvm.cc \
Logan Chien937105a2012-04-02 02:37:37 +080031 src/compiler_llvm/upcall_compiler.cc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080032
33# $(1): target or host
34# $(2): ndebug or debug
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080035define build-libart-compiler-llvm
36 ifneq ($(1),target)
37 ifneq ($(1),host)
38 $$(error expected target or host for argument 1, received $(1))
39 endif
40 endif
41 ifneq ($(2),ndebug)
42 ifneq ($(2),debug)
43 $$(error expected ndebug or debug for argument 2, received $(2))
44 endif
45 endif
46
47 art_target_or_host := $(1)
48 art_ndebug_or_debug := $(2)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080049
50 include $(CLEAR_VARS)
51 ifeq ($$(art_target_or_host),target)
52 include external/stlport/libstlport.mk
53 endif
54 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
55 ifeq ($$(art_ndebug_or_debug),ndebug)
56 LOCAL_MODULE := libart-compiler-llvm
57 else # debug
58 LOCAL_MODULE := libartd-compiler-llvm
59 endif
60
61 LOCAL_MODULE_TAGS := optional
62 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
63
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -070064 LOCAL_SRC_FILES := $(LIBART_COMPILER_LLVM_SRC_FILES)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080065 LOCAL_CFLAGS := $(LIBART_COMPILER_LLVM_CFLAGS)
66 ifeq ($$(art_target_or_host),target)
67 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
68 else # host
69 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
70 endif
71
72 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
73 LOCAL_C_INCLUDES += frameworks/compile/linkloader
74 libart_compiler_llvm_arm_STATIC_LIBRARIES := \
75 libLLVMARMInfo \
76 libLLVMARMDisassembler \
77 libLLVMARMAsmParser \
78 libLLVMARMAsmPrinter \
79 libLLVMARMCodeGen \
80 libLLVMARMDesc
81
Shih-wei Liao6e41d422012-03-26 23:43:02 -070082 libart_compiler_llvm_mips_STATIC_LIBRARIES := \
83 libLLVMMipsInfo \
84 libLLVMMipsCodeGen \
85 libLLVMMipsDesc \
Logan Chien0faf82f2012-03-27 15:12:48 +080086 libLLVMMipsAsmPrinter
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080087
88 libart_compiler_llvm_x86_STATIC_LIBRARIES := \
89 libLLVMX86Info \
90 libLLVMX86AsmParser \
91 libLLVMX86CodeGen \
92 libLLVMX86Disassembler \
93 libLLVMX86Desc \
94 libLLVMX86AsmPrinter \
95 libLLVMX86Utils
96
97 ifeq ($$(art_target_or_host),target)
98 LOCAL_STATIC_LIBRARIES += \
99 $$(libart_compiler_llvm_arm_STATIC_LIBRARIES)
100 else
101 LOCAL_STATIC_LIBRARIES += \
102 $$(libart_compiler_llvm_arm_STATIC_LIBRARIES) \
103 $$(libart_compiler_llvm_mips_STATIC_LIBRARIES) \
104 $$(libart_compiler_llvm_x86_STATIC_LIBRARIES)
105 endif
106
107 LOCAL_STATIC_LIBRARIES += \
108 libLLVMLinker \
109 libLLVMipo \
110 libLLVMBitWriter \
111 libLLVMBitReader \
112 libLLVMAsmPrinter \
113 libLLVMSelectionDAG \
114 libLLVMCodeGen \
Logan Chien0faf82f2012-03-27 15:12:48 +0800115 libLLVMVectorize \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800116 libLLVMScalarOpts \
117 libLLVMInstCombine \
118 libLLVMInstrumentation \
119 libLLVMTransformUtils \
120 libLLVMipa \
121 libLLVMAnalysis \
122 libLLVMTarget \
123 libLLVMMC \
124 libLLVMMCParser \
125 libLLVMCore \
126 libLLVMSupport \
127 librsloader
128 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
129 ifeq ($$(art_target_or_host),target)
130 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
131 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
132 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
133 else # host
134 LOCAL_STATIC_LIBRARIES += libcutils
135 LOCAL_SHARED_LIBRARIES += libz-host
136 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
137 LOCAL_LDLIBS := -ldl -lpthread
138 ifeq ($(HOST_OS),linux)
139 LOCAL_LDLIBS += -lrt
140 endif
141 endif
142 ifeq ($$(art_ndebug_or_debug),debug)
143 ifeq ($$(art_target_or_host),target)
144 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
145 else # host
146 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
147 endif
148 LOCAL_SHARED_LIBRARIES += libartd
149 else
150 ifeq ($$(art_target_or_host),target)
151 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
152 else # host
153 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
154 endif
155 LOCAL_SHARED_LIBRARIES += libart
156 endif
157 ifeq ($$(art_target_or_host),target)
158 include $(LLVM_GEN_INTRINSICS_MK)
159 include $(LLVM_DEVICE_BUILD_MK)
160 include $(BUILD_SHARED_LIBRARY)
161 else # host
162 LOCAL_IS_HOST_MODULE := true
163 include $(LLVM_GEN_INTRINSICS_MK)
164 include $(LLVM_HOST_BUILD_MK)
165 include $(BUILD_HOST_SHARED_LIBRARY)
166 endif
167
168 ifeq ($$(art_target_or_host),target)
169 ifeq ($$(art_ndebug_or_debug),debug)
170 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
171 else
172 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
173 endif
174 else # host
175 ifeq ($$(art_ndebug_or_debug),debug)
176 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
177 else
178 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
179 endif
180 endif
181
182endef
183
184ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700185 $(eval $(call build-libart-compiler-llvm,target,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800186endif
187ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700188 $(eval $(call build-libart-compiler-llvm,target,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800189endif
190ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700191 $(eval $(call build-libart-compiler-llvm,host,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800192endif
193ifeq ($(ART_BUILD_HOST_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700194 $(eval $(call build-libart-compiler-llvm,host,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800195endif