blob: b278310e5027a88d55fb21363b52cc654a171a49 [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
buzbeec531cef2012-10-18 07:09:20 -070019ifeq ($(ART_USE_PORTABLE_COMPILER),true)
20 ART_TEST_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
Shih-wei Liao21d28f52012-06-12 05:55:00 -070021endif
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080022
23LIBART_COMPILER_LLVM_SRC_FILES += \
24 src/compiler_llvm/compilation_unit.cc \
25 src/compiler_llvm/compiler_llvm.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080026 src/compiler_llvm/generated/art_module.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080027 src/compiler_llvm/ir_builder.cc \
28 src/compiler_llvm/jni_compiler.cc \
TDYa1271f196f12012-07-11 20:50:22 -070029 src/compiler_llvm/md_builder.cc \
TDYa127d668a062012-04-13 12:36:57 -070030 src/compiler_llvm/runtime_support_builder.cc \
31 src/compiler_llvm/runtime_support_builder_arm.cc \
TDYa127b08ed122012-06-05 23:51:19 -070032 src/compiler_llvm/runtime_support_builder_thumb2.cc \
TDYa127d668a062012-04-13 12:36:57 -070033 src/compiler_llvm/runtime_support_builder_x86.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080034 src/compiler_llvm/runtime_support_llvm.cc \
TDYa12789f96052012-07-12 20:49:53 -070035 src/compiler_llvm/stub_compiler.cc \
36 src/greenland/inferred_reg_category_map.cc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080037
buzbeec531cef2012-10-18 07:09:20 -070038ifeq ($(ART_USE_PORTABLE_COMPILER),true)
Shih-wei Liao21d28f52012-06-12 05:55:00 -070039 LIBART_COMPILER_LLVM_SRC_FILES += \
buzbee1bc37c62012-11-20 13:35:41 -080040 src/compiler/dataflow.cc \
41 src/compiler/frontend.cc \
42 src/compiler/intermediate_rep.cc \
43 src/compiler/ralloc.cc \
44 src/compiler/ssa_transformation.cc \
45 src/compiler/compiler_utility.cc \
46 src/compiler/codegen/ralloc_util.cc \
47 src/compiler/codegen/codegen_util.cc \
48 src/compiler/codegen/gen_loadstore.cc \
49 src/compiler/codegen/gen_common.cc \
50 src/compiler/codegen/gen_invoke.cc \
51 src/compiler/codegen/method_bitcode.cc \
52 src/compiler/codegen/method_codegen_driver.cc \
53 src/compiler/codegen/local_optimizations.cc \
54 src/compiler/codegen/arm/target_arm.cc \
55 src/compiler/codegen/arm/assemble_arm.cc \
56 src/compiler/codegen/arm/utility_arm.cc \
57 src/compiler/codegen/arm/call_arm.cc \
58 src/compiler/codegen/arm/fp_arm.cc \
59 src/compiler/codegen/arm/int_arm.cc \
60 src/compiler_llvm/dalvik_reg.cc \
61 src/compiler_llvm/gbc_expander.cc \
62 src/compiler_llvm/method_compiler.cc \
63 src/greenland/intrinsic_helper.cc \
64 src/greenland/ir_builder.cc
Shih-wei Liao21d28f52012-06-12 05:55:00 -070065else
buzbeec531cef2012-10-18 07:09:20 -070066 LIBART_COMPILER_LLVM_SRC_FILES += \
buzbee1bc37c62012-11-20 13:35:41 -080067 src/compiler_llvm/dalvik_reg.cc \
68 src/compiler_llvm/method_compiler.cc
Shih-wei Liao21d28f52012-06-12 05:55:00 -070069endif
70
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080071# $(1): target or host
72# $(2): ndebug or debug
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080073define build-libart-compiler-llvm
74 ifneq ($(1),target)
75 ifneq ($(1),host)
76 $$(error expected target or host for argument 1, received $(1))
77 endif
78 endif
79 ifneq ($(2),ndebug)
80 ifneq ($(2),debug)
81 $$(error expected ndebug or debug for argument 2, received $(2))
82 endif
83 endif
84
85 art_target_or_host := $(1)
86 art_ndebug_or_debug := $(2)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080087
88 include $(CLEAR_VARS)
89 ifeq ($$(art_target_or_host),target)
90 include external/stlport/libstlport.mk
91 endif
92 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
93 ifeq ($$(art_ndebug_or_debug),ndebug)
94 LOCAL_MODULE := libart-compiler-llvm
95 else # debug
96 LOCAL_MODULE := libartd-compiler-llvm
97 endif
98
99 LOCAL_MODULE_TAGS := optional
100 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
101
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700102 LOCAL_SRC_FILES := $(LIBART_COMPILER_LLVM_SRC_FILES)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800103 LOCAL_CFLAGS := $(LIBART_COMPILER_LLVM_CFLAGS)
104 ifeq ($$(art_target_or_host),target)
105 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
106 else # host
107 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
108 endif
109
110 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
Logan Chien971bf3f2012-05-01 15:47:55 +0800111
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800112 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Elliott Hughes46e251b2012-05-22 15:10:45 -0700113 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Shih-wei Liaocdc66902012-07-22 16:45:37 -0700114 LOCAL_SHARED_LIBRARIES += libbcc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800115 ifeq ($$(art_target_or_host),target)
116 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
117 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800118 else # host
119 LOCAL_STATIC_LIBRARIES += libcutils
120 LOCAL_SHARED_LIBRARIES += libz-host
121 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
122 LOCAL_LDLIBS := -ldl -lpthread
123 ifeq ($(HOST_OS),linux)
124 LOCAL_LDLIBS += -lrt
125 endif
126 endif
127 ifeq ($$(art_ndebug_or_debug),debug)
128 ifeq ($$(art_target_or_host),target)
129 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
130 else # host
131 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
132 endif
133 LOCAL_SHARED_LIBRARIES += libartd
134 else
135 ifeq ($$(art_target_or_host),target)
136 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
137 else # host
138 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
139 endif
140 LOCAL_SHARED_LIBRARIES += libart
141 endif
142 ifeq ($$(art_target_or_host),target)
143 include $(LLVM_GEN_INTRINSICS_MK)
144 include $(LLVM_DEVICE_BUILD_MK)
145 include $(BUILD_SHARED_LIBRARY)
146 else # host
147 LOCAL_IS_HOST_MODULE := true
148 include $(LLVM_GEN_INTRINSICS_MK)
149 include $(LLVM_HOST_BUILD_MK)
150 include $(BUILD_HOST_SHARED_LIBRARY)
151 endif
152
153 ifeq ($$(art_target_or_host),target)
154 ifeq ($$(art_ndebug_or_debug),debug)
155 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
156 else
157 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
158 endif
159 else # host
160 ifeq ($$(art_ndebug_or_debug),debug)
161 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
162 else
163 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
164 endif
165 endif
166
167endef
168
169ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700170 $(eval $(call build-libart-compiler-llvm,target,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800171endif
172ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700173 $(eval $(call build-libart-compiler-llvm,target,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800174endif
175ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700176 $(eval $(call build-libart-compiler-llvm,host,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800177endif
178ifeq ($(ART_BUILD_HOST_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700179 $(eval $(call build-libart-compiler-llvm,host,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800180endif