blob: ce6edbaf3306373094e14be6de644a405ceac560 [file] [log] [blame]
Elliott Hughesb3bd5f02012-03-08 21:05:27 -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
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -080017LIBART_COMPILER_SRC_FILES := \
buzbee311ca162013-02-28 15:56:43 -080018 src/compiler/dex/local_value_numbering.cc \
buzbee862a7602013-04-05 10:58:54 -070019 src/compiler/dex/arena_allocator.cc \
20 src/compiler/dex/arena_bit_vector.cc \
buzbee395116c2013-02-27 14:30:25 -080021 src/compiler/dex/quick/arm/assemble_arm.cc \
22 src/compiler/dex/quick/arm/call_arm.cc \
23 src/compiler/dex/quick/arm/fp_arm.cc \
24 src/compiler/dex/quick/arm/int_arm.cc \
25 src/compiler/dex/quick/arm/target_arm.cc \
26 src/compiler/dex/quick/arm/utility_arm.cc \
27 src/compiler/dex/quick/codegen_util.cc \
28 src/compiler/dex/quick/gen_common.cc \
29 src/compiler/dex/quick/gen_invoke.cc \
30 src/compiler/dex/quick/gen_loadstore.cc \
31 src/compiler/dex/quick/local_optimizations.cc \
32 src/compiler/dex/quick/mips/assemble_mips.cc \
33 src/compiler/dex/quick/mips/call_mips.cc \
34 src/compiler/dex/quick/mips/fp_mips.cc \
35 src/compiler/dex/quick/mips/int_mips.cc \
36 src/compiler/dex/quick/mips/target_mips.cc \
37 src/compiler/dex/quick/mips/utility_mips.cc \
38 src/compiler/dex/quick/mir_to_lir.cc \
39 src/compiler/dex/quick/ralloc_util.cc \
40 src/compiler/dex/quick/x86/assemble_x86.cc \
41 src/compiler/dex/quick/x86/call_x86.cc \
42 src/compiler/dex/quick/x86/fp_x86.cc \
43 src/compiler/dex/quick/x86/int_x86.cc \
44 src/compiler/dex/quick/x86/target_x86.cc \
45 src/compiler/dex/quick/x86/utility_x86.cc \
46 src/compiler/dex/portable/mir_to_gbc.cc \
Sebastien Hertz2d6ba512013-05-17 11:31:37 +020047 src/compiler/dex/dex_to_dex_compiler.cc \
buzbee311ca162013-02-28 15:56:43 -080048 src/compiler/dex/mir_dataflow.cc \
buzbee311ca162013-02-28 15:56:43 -080049 src/compiler/dex/mir_optimization.cc \
buzbee395116c2013-02-27 14:30:25 -080050 src/compiler/dex/frontend.cc \
buzbee311ca162013-02-28 15:56:43 -080051 src/compiler/dex/mir_graph.cc \
52 src/compiler/dex/vreg_analysis.cc \
buzbee395116c2013-02-27 14:30:25 -080053 src/compiler/dex/ssa_transformation.cc \
Brian Carlstrom51c24672013-07-11 16:00:56 -070054 src/compiler/driver/compiler_driver.cc \
Brian Carlstrom265091e2013-01-30 14:08:26 -080055 src/compiler/driver/dex_compilation_unit.cc \
Ian Rogers02113782013-03-04 12:12:48 -080056 src/compiler/jni/portable/jni_compiler.cc \
57 src/compiler/jni/quick/arm/calling_convention_arm.cc \
58 src/compiler/jni/quick/mips/calling_convention_mips.cc \
59 src/compiler/jni/quick/x86/calling_convention_x86.cc \
60 src/compiler/jni/quick/calling_convention.cc \
61 src/compiler/jni/quick/jni_compiler.cc \
Ian Rogers4c1c2832013-03-04 18:30:13 -080062 src/compiler/llvm/compiler_llvm.cc \
63 src/compiler/llvm/gbc_expander.cc \
64 src/compiler/llvm/generated/art_module.cc \
65 src/compiler/llvm/intrinsic_helper.cc \
66 src/compiler/llvm/ir_builder.cc \
67 src/compiler/llvm/llvm_compilation_unit.cc \
68 src/compiler/llvm/md_builder.cc \
69 src/compiler/llvm/runtime_support_builder.cc \
70 src/compiler/llvm/runtime_support_builder_arm.cc \
71 src/compiler/llvm/runtime_support_builder_thumb2.cc \
72 src/compiler/llvm/runtime_support_builder_x86.cc \
Brian Carlstrom51c24672013-07-11 16:00:56 -070073 src/compiler/stubs/portable/stubs.cc \
74 src/compiler/stubs/quick/stubs.cc \
75 src/compiler/elf_fixup.cc \
76 src/compiler/elf_stripper.cc \
77 src/compiler/elf_writer.cc \
78 src/compiler/elf_writer_quick.cc \
79 src/compiler/image_writer.cc \
80 src/compiler/oat_writer.cc
Ian Rogers01d11342013-02-28 00:15:33 -080081
Dragos Sbirlea7467ee02013-06-21 09:20:34 -070082ifeq ($(ART_SEA_IR_MODE),true)
83LIBART_COMPILER_SRC_FILES += \
Dragos Sbirlead25de7a2013-06-21 09:20:34 -070084 src/compiler/sea_ir/frontend.cc \
85 src/compiler/sea_ir/instruction_tools.cc
Dragos Sbirlea7467ee02013-06-21 09:20:34 -070086endif
87
Ian Rogers01d11342013-02-28 00:15:33 -080088LIBART_COMPILER_CFLAGS :=
89ifeq ($(ART_USE_PORTABLE_COMPILER),true)
Brian Carlstrom51c24672013-07-11 16:00:56 -070090 LIBART_COMPILER_SRC_FILES += src/compiler/elf_writer_mclinker.cc
Ian Rogers01d11342013-02-28 00:15:33 -080091 LIBART_COMPILER_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -080092endif
93
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080094# $(1): target or host
95# $(2): ndebug or debug
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080096define build-libart-compiler
97 ifneq ($(1),target)
98 ifneq ($(1),host)
99 $$(error expected target or host for argument 1, received $(1))
100 endif
101 endif
102 ifneq ($(2),ndebug)
103 ifneq ($(2),debug)
104 $$(error expected ndebug or debug for argument 2, received $(2))
105 endif
106 endif
107
108 art_target_or_host := $(1)
109 art_ndebug_or_debug := $(2)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800110
111 include $(CLEAR_VARS)
112 ifeq ($$(art_target_or_host),target)
113 include external/stlport/libstlport.mk
114 endif
115 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
116 ifeq ($$(art_ndebug_or_debug),ndebug)
buzbee8c4bbb52012-11-26 14:00:58 -0800117 LOCAL_MODULE := libart-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800118 else # debug
buzbee8c4bbb52012-11-26 14:00:58 -0800119 LOCAL_MODULE := libartd-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800120 endif
121
122 LOCAL_MODULE_TAGS := optional
123 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
124
buzbee8c4bbb52012-11-26 14:00:58 -0800125 LOCAL_SRC_FILES := $$(LIBART_COMPILER_SRC_FILES)
Brian Carlstrom5644f002012-06-27 23:05:17 -0700126
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800127 LOCAL_CFLAGS := $$(LIBART_COMPILER_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800128 ifeq ($$(art_target_or_host),target)
Ian Rogerscd5d0422013-05-17 15:54:01 -0700129 LOCAL_CLANG := $(ART_TARGET_CLANG)
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800130 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800131 else # host
Ian Rogerscd5d0422013-05-17 15:54:01 -0700132 LOCAL_CLANG := $(ART_HOST_CLANG)
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800133 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800134 endif
Elliott Hughes1bac54f2012-03-16 12:48:31 -0700135
136 # TODO: clean up the compilers and remove this.
137 LOCAL_CFLAGS += -Wno-unused-parameter
138
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800139 LOCAL_SHARED_LIBRARIES := liblog
140 ifeq ($$(art_ndebug_or_debug),debug)
141 ifeq ($$(art_target_or_host),target)
142 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
143 else # host
144 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
145 endif
146 LOCAL_SHARED_LIBRARIES += libartd
147 else
148 ifeq ($$(art_target_or_host),target)
149 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
150 else # host
151 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
152 endif
153 LOCAL_SHARED_LIBRARIES += libart
154 endif
Brian Carlstrom37d48792013-03-22 14:14:45 -0700155 LOCAL_SHARED_LIBRARIES += libbcc libLLVM
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800156
buzbeec531cef2012-10-18 07:09:20 -0700157 ifeq ($(ART_USE_PORTABLE_COMPILER),true)
Brian Carlstrom641ce032013-01-31 15:21:37 -0800158 LOCAL_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -0700159 endif
160
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800161 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
buzbee2cfc6392012-05-07 14:51:40 -0700162
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800163 ifeq ($$(art_target_or_host),target)
164 LOCAL_SHARED_LIBRARIES += libstlport
165 else # host
166 LOCAL_LDLIBS := -ldl -lpthread
167 endif
Brian Carlstrom51c24672013-07-11 16:00:56 -0700168 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/build/Android.common.mk
169 LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/build/Android.libart-compiler.mk
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800170 ifeq ($$(art_target_or_host),target)
buzbeec531cef2012-10-18 07:09:20 -0700171 LOCAL_SHARED_LIBRARIES += libcutils
172 include $(LLVM_GEN_INTRINSICS_MK)
173 include $(LLVM_DEVICE_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800174 include $(BUILD_SHARED_LIBRARY)
175 else # host
176 LOCAL_IS_HOST_MODULE := true
buzbeec531cef2012-10-18 07:09:20 -0700177 LOCAL_STATIC_LIBRARIES += libcutils
178 include $(LLVM_GEN_INTRINSICS_MK)
179 include $(LLVM_HOST_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800180 include $(BUILD_HOST_SHARED_LIBRARY)
181 endif
Brian Carlstrom73666be2012-03-10 20:25:10 -0800182
183 ifeq ($$(art_target_or_host),target)
184 ifeq ($$(art_ndebug_or_debug),debug)
185 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
186 else
187 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
188 endif
189 else # host
190 ifeq ($$(art_ndebug_or_debug),debug)
191 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
192 else
193 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
194 endif
195 endif
196
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800197endef
198
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800199ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800200 $(eval $(call build-libart-compiler,target,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800201endif
202ifeq ($(ART_BUILD_TARGET_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800203 $(eval $(call build-libart-compiler,target,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800204endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800205# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
206ifeq ($(ART_BUILD_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800207 $(eval $(call build-libart-compiler,host,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800208endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800209ifeq ($(ART_BUILD_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800210 $(eval $(call build-libart-compiler,host,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800211endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800212
Brian Carlstromecc66822013-03-29 16:58:30 -0700213# Rule to build /system/lib/libcompiler_rt.a
Brian Carlstrom265091e2013-01-30 14:08:26 -0800214# Usually static libraries are not installed on the device.
215ifeq ($(ART_USE_PORTABLE_COMPILER),true)
216ifeq ($(ART_BUILD_TARGET),true)
Brian Carlstromecc66822013-03-29 16:58:30 -0700217# TODO: Move to external/compiler_rt
218$(eval $(call copy-one-file, $(call intermediates-dir-for,STATIC_LIBRARIES,libcompiler_rt,,)/libcompiler_rt.a, $(TARGET_OUT_SHARED_LIBRARIES)/libcompiler_rt.a))
Brian Carlstrom265091e2013-01-30 14:08:26 -0800219
Brian Carlstromecc66822013-03-29 16:58:30 -0700220$(DEX2OAT): $(TARGET_OUT_SHARED_LIBRARIES)/libcompiler_rt.a
Brian Carlstrom265091e2013-01-30 14:08:26 -0800221
222endif
223endif