blob: fd599270e6d3306856a32c793c3daecfaa486b2d [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 \
Ian Rogers02113782013-03-04 12:12:48 -080051 src/compiler/jni/portable/jni_compiler.cc \
52 src/compiler/jni/quick/arm/calling_convention_arm.cc \
53 src/compiler/jni/quick/mips/calling_convention_mips.cc \
54 src/compiler/jni/quick/x86/calling_convention_x86.cc \
55 src/compiler/jni/quick/calling_convention.cc \
56 src/compiler/jni/quick/jni_compiler.cc \
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -080057 src/compiler_llvm/compiler_llvm.cc \
Ian Rogersc928de92013-02-27 14:30:44 -080058 src/compiler_llvm/gbc_expander.cc \
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -080059 src/compiler_llvm/generated/art_module.cc \
Ian Rogers76ae4fe2013-02-27 16:03:41 -080060 src/compiler_llvm/intrinsic_helper.cc \
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -080061 src/compiler_llvm/ir_builder.cc \
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -080062 src/compiler_llvm/llvm_compilation_unit.cc \
63 src/compiler_llvm/md_builder.cc \
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -080064 src/compiler_llvm/runtime_support_builder.cc \
65 src/compiler_llvm/runtime_support_builder_arm.cc \
66 src/compiler_llvm/runtime_support_builder_thumb2.cc \
67 src/compiler_llvm/runtime_support_builder_x86.cc \
68 src/compiler_llvm/runtime_support_llvm.cc \
Ian Rogers01d11342013-02-28 00:15:33 -080069 src/compiler_llvm/stub_compiler.cc \
70 src/elf_writer.cc \
Ian Rogers01d11342013-02-28 00:15:33 -080071 src/oat/jni/arm/jni_internal_arm.cc \
Ian Rogers01d11342013-02-28 00:15:33 -080072 src/oat/jni/mips/jni_internal_mips.cc \
Ian Rogers01d11342013-02-28 00:15:33 -080073 src/oat/jni/x86/jni_internal_x86.cc
74
75LIBART_COMPILER_CFLAGS :=
76ifeq ($(ART_USE_PORTABLE_COMPILER),true)
77 LIBART_COMPILER_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -080078endif
79
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080080# $(1): target or host
81# $(2): ndebug or debug
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080082define build-libart-compiler
83 ifneq ($(1),target)
84 ifneq ($(1),host)
85 $$(error expected target or host for argument 1, received $(1))
86 endif
87 endif
88 ifneq ($(2),ndebug)
89 ifneq ($(2),debug)
90 $$(error expected ndebug or debug for argument 2, received $(2))
91 endif
92 endif
93
94 art_target_or_host := $(1)
95 art_ndebug_or_debug := $(2)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080096
97 include $(CLEAR_VARS)
98 ifeq ($$(art_target_or_host),target)
99 include external/stlport/libstlport.mk
100 endif
101 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
102 ifeq ($$(art_ndebug_or_debug),ndebug)
buzbee8c4bbb52012-11-26 14:00:58 -0800103 LOCAL_MODULE := libart-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800104 else # debug
buzbee8c4bbb52012-11-26 14:00:58 -0800105 LOCAL_MODULE := libartd-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800106 endif
107
108 LOCAL_MODULE_TAGS := optional
109 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
110
buzbee8c4bbb52012-11-26 14:00:58 -0800111 LOCAL_SRC_FILES := $$(LIBART_COMPILER_SRC_FILES)
Brian Carlstrom5644f002012-06-27 23:05:17 -0700112
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800113 LOCAL_CFLAGS := $$(LIBART_COMPILER_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800114 ifeq ($$(art_target_or_host),target)
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800115 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800116 else # host
Brian Carlstrom00bc1dc2013-02-01 15:56:27 -0800117 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800118 endif
Elliott Hughes1bac54f2012-03-16 12:48:31 -0700119
120 # TODO: clean up the compilers and remove this.
121 LOCAL_CFLAGS += -Wno-unused-parameter
122
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800123 LOCAL_SHARED_LIBRARIES := liblog
124 ifeq ($$(art_ndebug_or_debug),debug)
125 ifeq ($$(art_target_or_host),target)
126 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
127 else # host
128 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
129 endif
130 LOCAL_SHARED_LIBRARIES += libartd
131 else
132 ifeq ($$(art_target_or_host),target)
133 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
134 else # host
135 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
136 endif
137 LOCAL_SHARED_LIBRARIES += libart
138 endif
buzbeec531cef2012-10-18 07:09:20 -0700139 LOCAL_SHARED_LIBRARIES += libbcc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800140
buzbeec531cef2012-10-18 07:09:20 -0700141 ifeq ($(ART_USE_PORTABLE_COMPILER),true)
Brian Carlstrom641ce032013-01-31 15:21:37 -0800142 LOCAL_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -0700143 endif
144
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800145 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
buzbee2cfc6392012-05-07 14:51:40 -0700146
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800147 ifeq ($$(art_target_or_host),target)
148 LOCAL_SHARED_LIBRARIES += libstlport
149 else # host
150 LOCAL_LDLIBS := -ldl -lpthread
151 endif
152 ifeq ($$(art_target_or_host),target)
buzbeec531cef2012-10-18 07:09:20 -0700153 LOCAL_SHARED_LIBRARIES += libcutils
154 include $(LLVM_GEN_INTRINSICS_MK)
155 include $(LLVM_DEVICE_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800156 include $(BUILD_SHARED_LIBRARY)
157 else # host
158 LOCAL_IS_HOST_MODULE := true
buzbeec531cef2012-10-18 07:09:20 -0700159 LOCAL_STATIC_LIBRARIES += libcutils
160 include $(LLVM_GEN_INTRINSICS_MK)
161 include $(LLVM_HOST_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800162 include $(BUILD_HOST_SHARED_LIBRARY)
163 endif
Brian Carlstrom73666be2012-03-10 20:25:10 -0800164
165 ifeq ($$(art_target_or_host),target)
166 ifeq ($$(art_ndebug_or_debug),debug)
167 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
168 else
169 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
170 endif
171 else # host
172 ifeq ($$(art_ndebug_or_debug),debug)
173 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
174 else
175 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
176 endif
177 endif
178
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800179endef
180
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800181ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800182 $(eval $(call build-libart-compiler,target,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800183endif
184ifeq ($(ART_BUILD_TARGET_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800185 $(eval $(call build-libart-compiler,target,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800186endif
187ifeq ($(ART_BUILD_HOST_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800188 $(eval $(call build-libart-compiler,host,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800189endif
190ifeq ($(ART_BUILD_HOST_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800191 $(eval $(call build-libart-compiler,host,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800192endif