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