blob: ac4bf42cfcde663b6dc2797e47123f2605a8f0e1 [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 \
buzbee395116c2013-02-27 14:30:25 -080019 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 \
buzbee311ca162013-02-28 15:56:43 -080046 src/compiler/dex/mir_dataflow.cc \
47 src/compiler/dex/dataflow_iterator.cc \
48 src/compiler/dex/mir_optimization.cc \
buzbee395116c2013-02-27 14:30:25 -080049 src/compiler/dex/frontend.cc \
buzbee311ca162013-02-28 15:56:43 -080050 src/compiler/dex/mir_graph.cc \
51 src/compiler/dex/vreg_analysis.cc \
buzbee395116c2013-02-27 14:30:25 -080052 src/compiler/dex/ssa_transformation.cc \
53 src/compiler/dex/write_elf.cc \
Brian Carlstrom265091e2013-01-30 14:08:26 -080054 src/compiler/driver/dex_compilation_unit.cc \
Ian Rogers4c1c2832013-03-04 18:30:13 -080055 src/compiler/invoke_stubs/portable/stub_compiler.cc \
56 src/compiler/invoke_stubs/quick/jni_internal_arm.cc \
57 src/compiler/invoke_stubs/quick/jni_internal_mips.cc \
58 src/compiler/invoke_stubs/quick/jni_internal_x86.cc \
Ian Rogers02113782013-03-04 12:12:48 -080059 src/compiler/jni/portable/jni_compiler.cc \
60 src/compiler/jni/quick/arm/calling_convention_arm.cc \
61 src/compiler/jni/quick/mips/calling_convention_mips.cc \
62 src/compiler/jni/quick/x86/calling_convention_x86.cc \
63 src/compiler/jni/quick/calling_convention.cc \
64 src/compiler/jni/quick/jni_compiler.cc \
Ian Rogers4c1c2832013-03-04 18:30:13 -080065 src/compiler/llvm/compiler_llvm.cc \
66 src/compiler/llvm/gbc_expander.cc \
67 src/compiler/llvm/generated/art_module.cc \
68 src/compiler/llvm/intrinsic_helper.cc \
69 src/compiler/llvm/ir_builder.cc \
70 src/compiler/llvm/llvm_compilation_unit.cc \
71 src/compiler/llvm/md_builder.cc \
72 src/compiler/llvm/runtime_support_builder.cc \
73 src/compiler/llvm/runtime_support_builder_arm.cc \
74 src/compiler/llvm/runtime_support_builder_thumb2.cc \
75 src/compiler/llvm/runtime_support_builder_x86.cc \
76 src/compiler/llvm/runtime_support_llvm.cc \
77 src/elf_writer.cc
Ian Rogers01d11342013-02-28 00:15:33 -080078
79LIBART_COMPILER_CFLAGS :=
80ifeq ($(ART_USE_PORTABLE_COMPILER),true)
81 LIBART_COMPILER_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -080082endif
83
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080084# $(1): target or host
85# $(2): ndebug or debug
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080086define build-libart-compiler
87 ifneq ($(1),target)
88 ifneq ($(1),host)
89 $$(error expected target or host for argument 1, received $(1))
90 endif
91 endif
92 ifneq ($(2),ndebug)
93 ifneq ($(2),debug)
94 $$(error expected ndebug or debug for argument 2, received $(2))
95 endif
96 endif
97
98 art_target_or_host := $(1)
99 art_ndebug_or_debug := $(2)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800100
101 include $(CLEAR_VARS)
102 ifeq ($$(art_target_or_host),target)
103 include external/stlport/libstlport.mk
104 endif
105 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
106 ifeq ($$(art_ndebug_or_debug),ndebug)
buzbee8c4bbb52012-11-26 14:00:58 -0800107 LOCAL_MODULE := libart-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800108 else # debug
buzbee8c4bbb52012-11-26 14:00:58 -0800109 LOCAL_MODULE := libartd-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800110 endif
111
112 LOCAL_MODULE_TAGS := optional
113 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
114
buzbee8c4bbb52012-11-26 14:00:58 -0800115 LOCAL_SRC_FILES := $$(LIBART_COMPILER_SRC_FILES)
Brian Carlstrom5644f002012-06-27 23:05:17 -0700116
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800117 LOCAL_CFLAGS := $$(LIBART_COMPILER_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800118 ifeq ($$(art_target_or_host),target)
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800119 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800120 else # host
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800121 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800122 endif
Elliott Hughes1bac54f2012-03-16 12:48:31 -0700123
124 # TODO: clean up the compilers and remove this.
125 LOCAL_CFLAGS += -Wno-unused-parameter
126
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800127 LOCAL_SHARED_LIBRARIES := liblog
128 ifeq ($$(art_ndebug_or_debug),debug)
129 ifeq ($$(art_target_or_host),target)
130 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
131 else # host
132 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
133 endif
134 LOCAL_SHARED_LIBRARIES += libartd
135 else
136 ifeq ($$(art_target_or_host),target)
137 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
138 else # host
139 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
140 endif
141 LOCAL_SHARED_LIBRARIES += libart
142 endif
Brian Carlstrom37d48792013-03-22 14:14:45 -0700143 LOCAL_SHARED_LIBRARIES += libbcc libLLVM
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800144
buzbeec531cef2012-10-18 07:09:20 -0700145 ifeq ($(ART_USE_PORTABLE_COMPILER),true)
Brian Carlstrom641ce032013-01-31 15:21:37 -0800146 LOCAL_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -0700147 endif
148
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800149 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
buzbee2cfc6392012-05-07 14:51:40 -0700150
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800151 ifeq ($$(art_target_or_host),target)
152 LOCAL_SHARED_LIBRARIES += libstlport
153 else # host
154 LOCAL_LDLIBS := -ldl -lpthread
155 endif
156 ifeq ($$(art_target_or_host),target)
buzbeec531cef2012-10-18 07:09:20 -0700157 LOCAL_SHARED_LIBRARIES += libcutils
158 include $(LLVM_GEN_INTRINSICS_MK)
159 include $(LLVM_DEVICE_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800160 include $(BUILD_SHARED_LIBRARY)
161 else # host
162 LOCAL_IS_HOST_MODULE := true
buzbeec531cef2012-10-18 07:09:20 -0700163 LOCAL_STATIC_LIBRARIES += libcutils
164 include $(LLVM_GEN_INTRINSICS_MK)
165 include $(LLVM_HOST_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800166 include $(BUILD_HOST_SHARED_LIBRARY)
167 endif
Brian Carlstrom73666be2012-03-10 20:25:10 -0800168
169 ifeq ($$(art_target_or_host),target)
170 ifeq ($$(art_ndebug_or_debug),debug)
171 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
172 else
173 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
174 endif
175 else # host
176 ifeq ($$(art_ndebug_or_debug),debug)
177 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
178 else
179 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
180 endif
181 endif
182
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800183endef
184
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800185ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800186 $(eval $(call build-libart-compiler,target,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800187endif
188ifeq ($(ART_BUILD_TARGET_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800189 $(eval $(call build-libart-compiler,target,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800190endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800191# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
192ifeq ($(ART_BUILD_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800193 $(eval $(call build-libart-compiler,host,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800194endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800195ifeq ($(ART_BUILD_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800196 $(eval $(call build-libart-compiler,host,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800197endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800198
199# Rule to build /system/lib/libcompiler-rt.a
200# Usually static libraries are not installed on the device.
201ifeq ($(ART_USE_PORTABLE_COMPILER),true)
202ifeq ($(ART_BUILD_TARGET),true)
203# TODO: Move to external/compiler-rt
204$(eval $(call copy-one-file, $(call intermediates-dir-for,STATIC_LIBRARIES,libcompiler-rt,,)/libcompiler-rt.a, $(TARGET_OUT_SHARED_LIBRARIES)/libcompiler-rt.a))
205
206$(DEX2OAT): $(TARGET_OUT_SHARED_LIBRARIES)/libcompiler-rt.a
207
208endif
209endif