blob: 79665e5c91625996033f4101bfa5f154891efd83 [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 \
65 src/greenland/dalvik_reg.cc \
66 src/greenland/dex_lang.cc \
67 src/greenland/intrinsic_helper.cc \
68 src/greenland/ir_builder.cc
69 else
70 LIBART_COMPILER_LLVM_SRC_FILES += \
71 src/compiler_llvm/dalvik_reg.cc \
72 src/compiler_llvm/method_compiler.cc
73 endif
Shih-wei Liao21d28f52012-06-12 05:55:00 -070074endif
75
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080076# $(1): target or host
77# $(2): ndebug or debug
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080078define build-libart-compiler-llvm
79 ifneq ($(1),target)
80 ifneq ($(1),host)
81 $$(error expected target or host for argument 1, received $(1))
82 endif
83 endif
84 ifneq ($(2),ndebug)
85 ifneq ($(2),debug)
86 $$(error expected ndebug or debug for argument 2, received $(2))
87 endif
88 endif
89
90 art_target_or_host := $(1)
91 art_ndebug_or_debug := $(2)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080092
93 include $(CLEAR_VARS)
94 ifeq ($$(art_target_or_host),target)
95 include external/stlport/libstlport.mk
96 endif
97 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
98 ifeq ($$(art_ndebug_or_debug),ndebug)
99 LOCAL_MODULE := libart-compiler-llvm
100 else # debug
101 LOCAL_MODULE := libartd-compiler-llvm
102 endif
103
104 LOCAL_MODULE_TAGS := optional
105 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
106
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700107 LOCAL_SRC_FILES := $(LIBART_COMPILER_LLVM_SRC_FILES)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800108 LOCAL_CFLAGS := $(LIBART_COMPILER_LLVM_CFLAGS)
109 ifeq ($$(art_target_or_host),target)
110 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
111 else # host
112 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
113 endif
114
115 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
Logan Chien971bf3f2012-05-01 15:47:55 +0800116
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800117 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Elliott Hughes46e251b2012-05-22 15:10:45 -0700118 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Shih-wei Liaocdc66902012-07-22 16:45:37 -0700119 LOCAL_SHARED_LIBRARIES += libbcc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800120 ifeq ($$(art_target_or_host),target)
121 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
122 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800123 else # host
124 LOCAL_STATIC_LIBRARIES += libcutils
125 LOCAL_SHARED_LIBRARIES += libz-host
126 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
127 LOCAL_LDLIBS := -ldl -lpthread
128 ifeq ($(HOST_OS),linux)
129 LOCAL_LDLIBS += -lrt
130 endif
131 endif
132 ifeq ($$(art_ndebug_or_debug),debug)
133 ifeq ($$(art_target_or_host),target)
134 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
135 else # host
136 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
137 endif
138 LOCAL_SHARED_LIBRARIES += libartd
139 else
140 ifeq ($$(art_target_or_host),target)
141 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
142 else # host
143 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
144 endif
145 LOCAL_SHARED_LIBRARIES += libart
146 endif
147 ifeq ($$(art_target_or_host),target)
148 include $(LLVM_GEN_INTRINSICS_MK)
149 include $(LLVM_DEVICE_BUILD_MK)
150 include $(BUILD_SHARED_LIBRARY)
151 else # host
152 LOCAL_IS_HOST_MODULE := true
153 include $(LLVM_GEN_INTRINSICS_MK)
154 include $(LLVM_HOST_BUILD_MK)
155 include $(BUILD_HOST_SHARED_LIBRARY)
156 endif
157
158 ifeq ($$(art_target_or_host),target)
159 ifeq ($$(art_ndebug_or_debug),debug)
160 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
161 else
162 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
163 endif
164 else # host
165 ifeq ($$(art_ndebug_or_debug),debug)
166 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
167 else
168 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
169 endif
170 endif
171
172endef
173
174ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700175 $(eval $(call build-libart-compiler-llvm,target,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800176endif
177ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700178 $(eval $(call build-libart-compiler-llvm,target,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800179endif
180ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700181 $(eval $(call build-libart-compiler-llvm,host,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800182endif
183ifeq ($(ART_BUILD_HOST_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700184 $(eval $(call build-libart-compiler-llvm,host,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800185endif