blob: 332b809053e9d763f620f8366ae48ffcd6a8524e [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
Shih-wei Liaobb33f2f2012-08-23 13:20:00 -070018LIBART_COMPILER_LLVM_CFLAGS := -DART_USE_LLVM_COMPILER
Shih-wei Liao21d28f52012-06-12 05:55:00 -070019ifeq ($(ART_USE_DEXLANG_FRONTEND),true)
Shih-wei Liaobb33f2f2012-08-23 13:20:00 -070020 LIBART_COMPILER_LLVM_CFLAGS += -DART_USE_DEXLANG_FRONTEND
21endif
22ifeq ($(ART_USE_QUICK_COMPILER),true)
23 LIBART_COMPILER_LLVM_CFLAGS += -DART_USE_QUICK_COMPILER
Shih-wei Liao21d28f52012-06-12 05:55:00 -070024endif
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080025
26LIBART_COMPILER_LLVM_SRC_FILES += \
27 src/compiler_llvm/compilation_unit.cc \
28 src/compiler_llvm/compiler_llvm.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080029 src/compiler_llvm/generated/art_module.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080030 src/compiler_llvm/ir_builder.cc \
31 src/compiler_llvm/jni_compiler.cc \
TDYa1271f196f12012-07-11 20:50:22 -070032 src/compiler_llvm/md_builder.cc \
TDYa127d668a062012-04-13 12:36:57 -070033 src/compiler_llvm/runtime_support_builder.cc \
34 src/compiler_llvm/runtime_support_builder_arm.cc \
TDYa127b08ed122012-06-05 23:51:19 -070035 src/compiler_llvm/runtime_support_builder_thumb2.cc \
TDYa127d668a062012-04-13 12:36:57 -070036 src/compiler_llvm/runtime_support_builder_x86.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080037 src/compiler_llvm/runtime_support_llvm.cc \
TDYa12789f96052012-07-12 20:49:53 -070038 src/compiler_llvm/stub_compiler.cc \
39 src/greenland/inferred_reg_category_map.cc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080040
Shih-wei Liao21d28f52012-06-12 05:55:00 -070041ifeq ($(ART_USE_DEXLANG_FRONTEND),true)
42 LIBART_COMPILER_LLVM_SRC_FILES += \
43 src/compiler_llvm/gbc_expander.cc \
44 src/greenland/dalvik_reg.cc \
45 src/greenland/dex_lang.cc \
46 src/greenland/intrinsic_helper.cc \
47 src/greenland/ir_builder.cc
48else
Shih-wei Liaobb33f2f2012-08-23 13:20:00 -070049 ifeq ($(ART_USE_QUICK_COMPILER),true)
50 LIBART_COMPILER_LLVM_SRC_FILES += \
51 src/compiler/Dataflow.cc \
52 src/compiler/Frontend.cc \
53 src/compiler/IntermediateRep.cc \
54 src/compiler/Ralloc.cc \
55 src/compiler/SSATransformation.cc \
56 src/compiler/Utility.cc \
57 src/compiler/codegen/RallocUtil.cc \
58 src/compiler/codegen/arm/ArchUtility.cc \
59 src/compiler/codegen/arm/ArmRallocUtil.cc \
60 src/compiler/codegen/arm/Assemble.cc \
61 src/compiler/codegen/arm/armv7-a/Codegen.cc \
62 src/compiler_llvm/dalvik_reg.cc \
63 src/compiler_llvm/gbc_expander.cc \
64 src/compiler_llvm/method_compiler.cc \
Shih-wei Liaobb33f2f2012-08-23 13:20:00 -070065 src/greenland/intrinsic_helper.cc \
66 src/greenland/ir_builder.cc
67 else
68 LIBART_COMPILER_LLVM_SRC_FILES += \
69 src/compiler_llvm/dalvik_reg.cc \
70 src/compiler_llvm/method_compiler.cc
71 endif
Shih-wei Liao21d28f52012-06-12 05:55:00 -070072endif
73
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080074# $(1): target or host
75# $(2): ndebug or debug
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080076define build-libart-compiler-llvm
77 ifneq ($(1),target)
78 ifneq ($(1),host)
79 $$(error expected target or host for argument 1, received $(1))
80 endif
81 endif
82 ifneq ($(2),ndebug)
83 ifneq ($(2),debug)
84 $$(error expected ndebug or debug for argument 2, received $(2))
85 endif
86 endif
87
88 art_target_or_host := $(1)
89 art_ndebug_or_debug := $(2)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080090
91 include $(CLEAR_VARS)
92 ifeq ($$(art_target_or_host),target)
93 include external/stlport/libstlport.mk
94 endif
95 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
96 ifeq ($$(art_ndebug_or_debug),ndebug)
97 LOCAL_MODULE := libart-compiler-llvm
98 else # debug
99 LOCAL_MODULE := libartd-compiler-llvm
100 endif
101
102 LOCAL_MODULE_TAGS := optional
103 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
104
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700105 LOCAL_SRC_FILES := $(LIBART_COMPILER_LLVM_SRC_FILES)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800106 LOCAL_CFLAGS := $(LIBART_COMPILER_LLVM_CFLAGS)
107 ifeq ($$(art_target_or_host),target)
108 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
109 else # host
110 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
111 endif
112
113 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
Logan Chien971bf3f2012-05-01 15:47:55 +0800114
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800115 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Elliott Hughes46e251b2012-05-22 15:10:45 -0700116 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Shih-wei Liaocdc66902012-07-22 16:45:37 -0700117 LOCAL_SHARED_LIBRARIES += libbcc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800118 ifeq ($$(art_target_or_host),target)
119 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
120 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800121 else # host
122 LOCAL_STATIC_LIBRARIES += libcutils
123 LOCAL_SHARED_LIBRARIES += libz-host
124 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
125 LOCAL_LDLIBS := -ldl -lpthread
126 ifeq ($(HOST_OS),linux)
127 LOCAL_LDLIBS += -lrt
128 endif
129 endif
130 ifeq ($$(art_ndebug_or_debug),debug)
131 ifeq ($$(art_target_or_host),target)
132 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
133 else # host
134 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
135 endif
136 LOCAL_SHARED_LIBRARIES += libartd
137 else
138 ifeq ($$(art_target_or_host),target)
139 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
140 else # host
141 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
142 endif
143 LOCAL_SHARED_LIBRARIES += libart
144 endif
145 ifeq ($$(art_target_or_host),target)
146 include $(LLVM_GEN_INTRINSICS_MK)
147 include $(LLVM_DEVICE_BUILD_MK)
148 include $(BUILD_SHARED_LIBRARY)
149 else # host
150 LOCAL_IS_HOST_MODULE := true
151 include $(LLVM_GEN_INTRINSICS_MK)
152 include $(LLVM_HOST_BUILD_MK)
153 include $(BUILD_HOST_SHARED_LIBRARY)
154 endif
155
156 ifeq ($$(art_target_or_host),target)
157 ifeq ($$(art_ndebug_or_debug),debug)
158 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
159 else
160 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
161 endif
162 else # host
163 ifeq ($$(art_ndebug_or_debug),debug)
164 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
165 else
166 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
167 endif
168 endif
169
170endef
171
172ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700173 $(eval $(call build-libart-compiler-llvm,target,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800174endif
175ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700176 $(eval $(call build-libart-compiler-llvm,target,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800177endif
178ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700179 $(eval $(call build-libart-compiler-llvm,host,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800180endif
181ifeq ($(ART_BUILD_HOST_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700182 $(eval $(call build-libart-compiler-llvm,host,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800183endif