blob: 8f0ccf83d7003cf8ac20083f2085aa229621d7b2 [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 := \
buzbee395116c2013-02-27 14:30:25 -080018 src/compiler/dex/bb_opt.cc \
19 src/compiler/dex/quick/arm/assemble_arm.cc \
20 src/compiler/dex/quick/arm/call_arm.cc \
21 src/compiler/dex/quick/arm/fp_arm.cc \
22 src/compiler/dex/quick/arm/int_arm.cc \
23 src/compiler/dex/quick/arm/target_arm.cc \
24 src/compiler/dex/quick/arm/utility_arm.cc \
25 src/compiler/dex/quick/codegen_util.cc \
26 src/compiler/dex/quick/gen_common.cc \
27 src/compiler/dex/quick/gen_invoke.cc \
28 src/compiler/dex/quick/gen_loadstore.cc \
29 src/compiler/dex/quick/local_optimizations.cc \
30 src/compiler/dex/quick/mips/assemble_mips.cc \
31 src/compiler/dex/quick/mips/call_mips.cc \
32 src/compiler/dex/quick/mips/fp_mips.cc \
33 src/compiler/dex/quick/mips/int_mips.cc \
34 src/compiler/dex/quick/mips/target_mips.cc \
35 src/compiler/dex/quick/mips/utility_mips.cc \
36 src/compiler/dex/quick/mir_to_lir.cc \
37 src/compiler/dex/quick/ralloc_util.cc \
38 src/compiler/dex/quick/x86/assemble_x86.cc \
39 src/compiler/dex/quick/x86/call_x86.cc \
40 src/compiler/dex/quick/x86/fp_x86.cc \
41 src/compiler/dex/quick/x86/int_x86.cc \
42 src/compiler/dex/quick/x86/target_x86.cc \
43 src/compiler/dex/quick/x86/utility_x86.cc \
44 src/compiler/dex/portable/mir_to_gbc.cc \
45 src/compiler/dex/compiler_utility.cc \
46 src/compiler/dex/dataflow.cc \
47 src/compiler/dex/frontend.cc \
48 src/compiler/dex/ralloc.cc \
49 src/compiler/dex/ssa_transformation.cc \
50 src/compiler/dex/write_elf.cc \
Brian Carlstrom265091e2013-01-30 14:08:26 -080051 src/compiler/driver/dex_compilation_unit.cc \
Ian Rogers4c1c2832013-03-04 18:30:13 -080052 src/compiler/invoke_stubs/portable/stub_compiler.cc \
53 src/compiler/invoke_stubs/quick/jni_internal_arm.cc \
54 src/compiler/invoke_stubs/quick/jni_internal_mips.cc \
55 src/compiler/invoke_stubs/quick/jni_internal_x86.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 \
73 src/compiler/llvm/runtime_support_llvm.cc \
74 src/elf_writer.cc
Ian Rogers01d11342013-02-28 00:15:33 -080075
76LIBART_COMPILER_CFLAGS :=
77ifeq ($(ART_USE_PORTABLE_COMPILER),true)
78 LIBART_COMPILER_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -080079endif
80
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080081# $(1): target or host
82# $(2): ndebug or debug
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080083define build-libart-compiler
84 ifneq ($(1),target)
85 ifneq ($(1),host)
86 $$(error expected target or host for argument 1, received $(1))
87 endif
88 endif
89 ifneq ($(2),ndebug)
90 ifneq ($(2),debug)
91 $$(error expected ndebug or debug for argument 2, received $(2))
92 endif
93 endif
94
95 art_target_or_host := $(1)
96 art_ndebug_or_debug := $(2)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080097
98 include $(CLEAR_VARS)
99 ifeq ($$(art_target_or_host),target)
100 include external/stlport/libstlport.mk
101 endif
102 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
103 ifeq ($$(art_ndebug_or_debug),ndebug)
buzbee8c4bbb52012-11-26 14:00:58 -0800104 LOCAL_MODULE := libart-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800105 else # debug
buzbee8c4bbb52012-11-26 14:00:58 -0800106 LOCAL_MODULE := libartd-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800107 endif
108
109 LOCAL_MODULE_TAGS := optional
110 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
111
buzbee8c4bbb52012-11-26 14:00:58 -0800112 LOCAL_SRC_FILES := $$(LIBART_COMPILER_SRC_FILES)
Brian Carlstrom5644f002012-06-27 23:05:17 -0700113
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800114 LOCAL_CFLAGS := $$(LIBART_COMPILER_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800115 ifeq ($$(art_target_or_host),target)
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800116 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800117 else # host
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800118 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800119 endif
Elliott Hughes1bac54f2012-03-16 12:48:31 -0700120
121 # TODO: clean up the compilers and remove this.
122 LOCAL_CFLAGS += -Wno-unused-parameter
123
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800124 LOCAL_SHARED_LIBRARIES := liblog
125 ifeq ($$(art_ndebug_or_debug),debug)
126 ifeq ($$(art_target_or_host),target)
127 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
128 else # host
129 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
130 endif
131 LOCAL_SHARED_LIBRARIES += libartd
132 else
133 ifeq ($$(art_target_or_host),target)
134 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
135 else # host
136 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
137 endif
138 LOCAL_SHARED_LIBRARIES += libart
139 endif
buzbeec531cef2012-10-18 07:09:20 -0700140 LOCAL_SHARED_LIBRARIES += libbcc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800141
buzbeec531cef2012-10-18 07:09:20 -0700142 ifeq ($(ART_USE_PORTABLE_COMPILER),true)
Brian Carlstrom641ce032013-01-31 15:21:37 -0800143 LOCAL_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -0700144 endif
145
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800146 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
buzbee2cfc6392012-05-07 14:51:40 -0700147
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800148 ifeq ($$(art_target_or_host),target)
149 LOCAL_SHARED_LIBRARIES += libstlport
150 else # host
151 LOCAL_LDLIBS := -ldl -lpthread
152 endif
153 ifeq ($$(art_target_or_host),target)
buzbeec531cef2012-10-18 07:09:20 -0700154 LOCAL_SHARED_LIBRARIES += libcutils
155 include $(LLVM_GEN_INTRINSICS_MK)
156 include $(LLVM_DEVICE_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800157 include $(BUILD_SHARED_LIBRARY)
158 else # host
159 LOCAL_IS_HOST_MODULE := true
buzbeec531cef2012-10-18 07:09:20 -0700160 LOCAL_STATIC_LIBRARIES += libcutils
161 include $(LLVM_GEN_INTRINSICS_MK)
162 include $(LLVM_HOST_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800163 include $(BUILD_HOST_SHARED_LIBRARY)
164 endif
Brian Carlstrom73666be2012-03-10 20:25:10 -0800165
166 ifeq ($$(art_target_or_host),target)
167 ifeq ($$(art_ndebug_or_debug),debug)
168 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
169 else
170 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
171 endif
172 else # host
173 ifeq ($$(art_ndebug_or_debug),debug)
174 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
175 else
176 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
177 endif
178 endif
179
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800180endef
181
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800182ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800183 $(eval $(call build-libart-compiler,target,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800184endif
185ifeq ($(ART_BUILD_TARGET_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800186 $(eval $(call build-libart-compiler,target,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800187endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800188# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
189ifeq ($(ART_BUILD_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800190 $(eval $(call build-libart-compiler,host,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800191endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800192ifeq ($(ART_BUILD_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800193 $(eval $(call build-libart-compiler,host,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800194endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800195
196# Rule to build /system/lib/libcompiler-rt.a
197# Usually static libraries are not installed on the device.
198ifeq ($(ART_USE_PORTABLE_COMPILER),true)
199ifeq ($(ART_BUILD_TARGET),true)
200# TODO: Move to external/compiler-rt
201$(eval $(call copy-one-file, $(call intermediates-dir-for,STATIC_LIBRARIES,libcompiler-rt,,)/libcompiler-rt.a, $(TARGET_OUT_SHARED_LIBRARIES)/libcompiler-rt.a))
202
203$(DEX2OAT): $(TARGET_OUT_SHARED_LIBRARIES)/libcompiler-rt.a
204
205endif
206endif