blob: 9100646b9d04c646b42cac7b82eb0cd877160b7d [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 \
Logan Chienf7015fd2012-03-18 01:19:37 +080024 src/compiler_llvm/elf_loader.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080025 src/compiler_llvm/frontend.cc \
26 src/compiler_llvm/generated/art_module.cc \
27 src/compiler_llvm/inferred_reg_category_map.cc \
28 src/compiler_llvm/ir_builder.cc \
29 src/compiler_llvm/jni_compiler.cc \
30 src/compiler_llvm/method_compiler.cc \
31 src/compiler_llvm/runtime_support_llvm.cc \
32 src/compiler_llvm/upcall_compiler.cc \
33 src/compiler_llvm/utils_llvm.cc
34
35# $(1): target or host
36# $(2): ndebug or debug
37# $(3): architecture name
38# $(4): list of source files
39define 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)
53 libart_compiler_llvm_src_files := $(3)
54
55 include $(CLEAR_VARS)
56 ifeq ($$(art_target_or_host),target)
57 include external/stlport/libstlport.mk
58 endif
59 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
60 ifeq ($$(art_ndebug_or_debug),ndebug)
61 LOCAL_MODULE := libart-compiler-llvm
62 else # debug
63 LOCAL_MODULE := libartd-compiler-llvm
64 endif
65
66 LOCAL_MODULE_TAGS := optional
67 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
68
69 LOCAL_SRC_FILES := $(libart_compiler_llvm_src_files)
70 LOCAL_CFLAGS := $(LIBART_COMPILER_LLVM_CFLAGS)
71 ifeq ($$(art_target_or_host),target)
72 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
73 else # host
74 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
75 endif
76
77 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
78 LOCAL_C_INCLUDES += frameworks/compile/linkloader
79 libart_compiler_llvm_arm_STATIC_LIBRARIES := \
80 libLLVMARMInfo \
81 libLLVMARMDisassembler \
82 libLLVMARMAsmParser \
83 libLLVMARMAsmPrinter \
84 libLLVMARMCodeGen \
85 libLLVMARMDesc
86
Shih-wei Liao6e41d422012-03-26 23:43:02 -070087 libart_compiler_llvm_mips_STATIC_LIBRARIES := \
88 libLLVMMipsInfo \
89 libLLVMMipsCodeGen \
90 libLLVMMipsDesc \
Logan Chien0faf82f2012-03-27 15:12:48 +080091 libLLVMMipsAsmPrinter
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080092
93 libart_compiler_llvm_x86_STATIC_LIBRARIES := \
94 libLLVMX86Info \
95 libLLVMX86AsmParser \
96 libLLVMX86CodeGen \
97 libLLVMX86Disassembler \
98 libLLVMX86Desc \
99 libLLVMX86AsmPrinter \
100 libLLVMX86Utils
101
102 ifeq ($$(art_target_or_host),target)
103 LOCAL_STATIC_LIBRARIES += \
104 $$(libart_compiler_llvm_arm_STATIC_LIBRARIES)
105 else
106 LOCAL_STATIC_LIBRARIES += \
107 $$(libart_compiler_llvm_arm_STATIC_LIBRARIES) \
108 $$(libart_compiler_llvm_mips_STATIC_LIBRARIES) \
109 $$(libart_compiler_llvm_x86_STATIC_LIBRARIES)
110 endif
111
112 LOCAL_STATIC_LIBRARIES += \
113 libLLVMLinker \
114 libLLVMipo \
115 libLLVMBitWriter \
116 libLLVMBitReader \
117 libLLVMAsmPrinter \
118 libLLVMSelectionDAG \
119 libLLVMCodeGen \
Logan Chien0faf82f2012-03-27 15:12:48 +0800120 libLLVMVectorize \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800121 libLLVMScalarOpts \
122 libLLVMInstCombine \
123 libLLVMInstrumentation \
124 libLLVMTransformUtils \
125 libLLVMipa \
126 libLLVMAnalysis \
127 libLLVMTarget \
128 libLLVMMC \
129 libLLVMMCParser \
130 libLLVMCore \
131 libLLVMSupport \
132 librsloader
133 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
134 ifeq ($$(art_target_or_host),target)
135 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
136 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
137 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
138 else # host
139 LOCAL_STATIC_LIBRARIES += libcutils
140 LOCAL_SHARED_LIBRARIES += libz-host
141 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
142 LOCAL_LDLIBS := -ldl -lpthread
143 ifeq ($(HOST_OS),linux)
144 LOCAL_LDLIBS += -lrt
145 endif
146 endif
147 ifeq ($$(art_ndebug_or_debug),debug)
148 ifeq ($$(art_target_or_host),target)
149 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
150 else # host
151 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
152 endif
153 LOCAL_SHARED_LIBRARIES += libartd
154 else
155 ifeq ($$(art_target_or_host),target)
156 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
157 else # host
158 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
159 endif
160 LOCAL_SHARED_LIBRARIES += libart
161 endif
162 ifeq ($$(art_target_or_host),target)
163 include $(LLVM_GEN_INTRINSICS_MK)
164 include $(LLVM_DEVICE_BUILD_MK)
165 include $(BUILD_SHARED_LIBRARY)
166 else # host
167 LOCAL_IS_HOST_MODULE := true
168 include $(LLVM_GEN_INTRINSICS_MK)
169 include $(LLVM_HOST_BUILD_MK)
170 include $(BUILD_HOST_SHARED_LIBRARY)
171 endif
172
173 ifeq ($$(art_target_or_host),target)
174 ifeq ($$(art_ndebug_or_debug),debug)
175 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
176 else
177 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
178 endif
179 else # host
180 ifeq ($$(art_ndebug_or_debug),debug)
181 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
182 else
183 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
184 endif
185 endif
186
187endef
188
189ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
190 $(eval $(call build-libart-compiler-llvm,target,ndebug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
191endif
192ifeq ($(ART_BUILD_TARGET_DEBUG),true)
193 $(eval $(call build-libart-compiler-llvm,target,debug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
194endif
195ifeq ($(ART_BUILD_HOST_NDEBUG),true)
196 $(eval $(call build-libart-compiler-llvm,host,ndebug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
197endif
198ifeq ($(ART_BUILD_HOST_DEBUG),true)
199 $(eval $(call build-libart-compiler-llvm,host,debug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
200endif