blob: bb7b45814ad8736160226ffd3bf478e66a44dabe [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 \
31 src/compiler_llvm/upcall_compiler.cc \
32 src/compiler_llvm/utils_llvm.cc
33
34# $(1): target or host
35# $(2): ndebug or debug
36# $(3): architecture name
37# $(4): list of source files
38define 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)
52 libart_compiler_llvm_src_files := $(3)
53
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
68 LOCAL_SRC_FILES := $(libart_compiler_llvm_src_files)
69 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)
77 LOCAL_C_INCLUDES += frameworks/compile/linkloader
78 libart_compiler_llvm_arm_STATIC_LIBRARIES := \
79 libLLVMARMInfo \
80 libLLVMARMDisassembler \
81 libLLVMARMAsmParser \
82 libLLVMARMAsmPrinter \
83 libLLVMARMCodeGen \
84 libLLVMARMDesc
85
86 libart_compiler_llvm_mips_STATIC_LIBRARIES := \
87 libLLVMMipsInfo \
88 libLLVMMipsCodeGen \
89 libLLVMMipsDesc \
90 libLLVMMipsAsmPrinter \
91
92 libart_compiler_llvm_x86_STATIC_LIBRARIES := \
93 libLLVMX86Info \
94 libLLVMX86AsmParser \
95 libLLVMX86CodeGen \
96 libLLVMX86Disassembler \
97 libLLVMX86Desc \
98 libLLVMX86AsmPrinter \
99 libLLVMX86Utils
100
101 ifeq ($$(art_target_or_host),target)
102 LOCAL_STATIC_LIBRARIES += \
103 $$(libart_compiler_llvm_arm_STATIC_LIBRARIES)
104 else
105 LOCAL_STATIC_LIBRARIES += \
106 $$(libart_compiler_llvm_arm_STATIC_LIBRARIES) \
107 $$(libart_compiler_llvm_mips_STATIC_LIBRARIES) \
108 $$(libart_compiler_llvm_x86_STATIC_LIBRARIES)
109 endif
110
111 LOCAL_STATIC_LIBRARIES += \
112 libLLVMLinker \
113 libLLVMipo \
114 libLLVMBitWriter \
115 libLLVMBitReader \
116 libLLVMAsmPrinter \
117 libLLVMSelectionDAG \
118 libLLVMCodeGen \
119 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)
188 $(eval $(call build-libart-compiler-llvm,target,ndebug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
189endif
190ifeq ($(ART_BUILD_TARGET_DEBUG),true)
191 $(eval $(call build-libart-compiler-llvm,target,debug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
192endif
193ifeq ($(ART_BUILD_HOST_NDEBUG),true)
194 $(eval $(call build-libart-compiler-llvm,host,ndebug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
195endif
196ifeq ($(ART_BUILD_HOST_DEBUG),true)
197 $(eval $(call build-libart-compiler-llvm,host,debug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
198endif