blob: 3f3c23ddf70a67e7f8672985a2598bc70a235795 [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
17LIBART_COMPILER_COMMON_SRC_FILES += \
18 src/compiler/Dataflow.cc \
19 src/compiler/Frontend.cc \
20 src/compiler/IntermediateRep.cc \
21 src/compiler/Ralloc.cc \
22 src/compiler/SSATransformation.cc \
23 src/compiler/Utility.cc \
Elliott Hughes46f060a2012-03-09 17:36:50 -080024 src/compiler/codegen/RallocUtil.cc \
Ian Rogers57b86d42012-03-27 16:05:41 -070025 src/oat/jni/calling_convention.cc \
26 src/oat/jni/jni_compiler.cc \
27 src/oat/jni/arm/calling_convention_arm.cc \
28 src/oat/jni/x86/calling_convention_x86.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080029
buzbee2cfc6392012-05-07 14:51:40 -070030ifeq ($(ART_USE_QUICK_COMPILER), true)
31LIBART_COMPILER_COMMON_SRC_FILES += \
32 src/greenland/ir_builder.cc \
33 src/greenland/intrinsic_helper.cc
34endif
35
Brian Carlstrom5644f002012-06-27 23:05:17 -070036LIBART_COMPILER_arm_SRC_FILES += \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080037 $(LIBART_COMPILER_COMMON_SRC_FILES) \
38 src/compiler/codegen/arm/ArchUtility.cc \
39 src/compiler/codegen/arm/ArmRallocUtil.cc \
40 src/compiler/codegen/arm/Assemble.cc \
Ian Rogers57b86d42012-03-27 16:05:41 -070041 src/compiler/codegen/arm/armv7-a/Codegen.cc \
42 src/oat/jni/arm/jni_internal_arm.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080043
Brian Carlstrom5644f002012-06-27 23:05:17 -070044LIBART_COMPILER_mips_SRC_FILES += \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080045 $(LIBART_COMPILER_COMMON_SRC_FILES) \
46 src/compiler/codegen/mips/ArchUtility.cc \
47 src/compiler/codegen/mips/MipsRallocUtil.cc \
48 src/compiler/codegen/mips/Assemble.cc \
49 src/compiler/codegen/mips/mips/Codegen.cc
50
Brian Carlstrom5644f002012-06-27 23:05:17 -070051LIBART_COMPILER_x86_SRC_FILES += \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080052 $(LIBART_COMPILER_COMMON_SRC_FILES) \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080053 src/compiler/codegen/x86/ArchUtility.cc \
54 src/compiler/codegen/x86/X86RallocUtil.cc \
55 src/compiler/codegen/x86/Assemble.cc \
Ian Rogers57b86d42012-03-27 16:05:41 -070056 src/compiler/codegen/x86/x86/Codegen.cc \
57 src/oat/jni/x86/jni_internal_x86.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080058
59# $(1): target or host
60# $(2): ndebug or debug
61# $(3): architecture name
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080062define build-libart-compiler
63 ifneq ($(1),target)
64 ifneq ($(1),host)
65 $$(error expected target or host for argument 1, received $(1))
66 endif
67 endif
68 ifneq ($(2),ndebug)
69 ifneq ($(2),debug)
70 $$(error expected ndebug or debug for argument 2, received $(2))
71 endif
72 endif
73
74 art_target_or_host := $(1)
75 art_ndebug_or_debug := $(2)
76 libart_compiler_arch := $(3)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080077
78 include $(CLEAR_VARS)
79 ifeq ($$(art_target_or_host),target)
80 include external/stlport/libstlport.mk
81 endif
82 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
83 ifeq ($$(art_ndebug_or_debug),ndebug)
Elliott Hughesceeea7d2012-04-10 11:35:08 -070084 LOCAL_MODULE := libart-compiler-$$(libart_compiler_arch)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080085 else # debug
Elliott Hughesceeea7d2012-04-10 11:35:08 -070086 LOCAL_MODULE := libartd-compiler-$$(libart_compiler_arch)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080087 endif
88
89 LOCAL_MODULE_TAGS := optional
90 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
91
Brian Carlstrom5644f002012-06-27 23:05:17 -070092 LOCAL_SRC_FILES := $$(LIBART_COMPILER_$$(libart_compiler_arch)_SRC_FILES)
93
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080094 ifeq ($$(art_target_or_host),target)
95 LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
96 else # host
97 LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
98 endif
Elliott Hughes1bac54f2012-03-16 12:48:31 -070099
100 # TODO: clean up the compilers and remove this.
101 LOCAL_CFLAGS += -Wno-unused-parameter
102
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800103 LOCAL_SHARED_LIBRARIES := liblog
104 ifeq ($$(art_ndebug_or_debug),debug)
105 ifeq ($$(art_target_or_host),target)
106 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
107 else # host
108 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
109 endif
110 LOCAL_SHARED_LIBRARIES += libartd
111 else
112 ifeq ($$(art_target_or_host),target)
113 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
114 else # host
115 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
116 endif
117 LOCAL_SHARED_LIBRARIES += libart
118 endif
119
120 # TODO: temporary hack for testing.
Brian Carlstrom5644f002012-06-27 23:05:17 -0700121 ifeq ($$(libart_compiler_arch),mips)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800122 LOCAL_CFLAGS += -D__mips_hard_float
123 endif
124
buzbee2cfc6392012-05-07 14:51:40 -0700125 ifeq ($(ART_USE_QUICK_COMPILER), true)
126 LOCAL_CFLAGS += -DART_USE_QUICK_COMPILER
127 endif
128
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800129 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
buzbee2cfc6392012-05-07 14:51:40 -0700130
131 ifeq ($(ART_USE_QUICK_COMPILER), true)
132 LOCAL_STATIC_LIBRARIES += \
133 libLLVMBitWriter \
134 libLLVMBitReader \
135 libLLVMCore \
136 libLLVMSupport
137 endif
138
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800139 ifeq ($$(art_target_or_host),target)
140 LOCAL_SHARED_LIBRARIES += libstlport
141 else # host
142 LOCAL_LDLIBS := -ldl -lpthread
143 endif
144 ifeq ($$(art_target_or_host),target)
buzbee2cfc6392012-05-07 14:51:40 -0700145 ifeq ($(ART_USE_QUICK_COMPILER), true)
146 LOCAL_SHARED_LIBRARIES += libcutils
147 include $(LLVM_GEN_INTRINSICS_MK)
148 include $(LLVM_DEVICE_BUILD_MK)
149 endif
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800150 include $(BUILD_SHARED_LIBRARY)
151 else # host
152 LOCAL_IS_HOST_MODULE := true
buzbee2cfc6392012-05-07 14:51:40 -0700153 ifeq ($(ART_USE_QUICK_COMPILER), true)
154 LOCAL_STATIC_LIBRARIES += libcutils
155 include $(LLVM_GEN_INTRINSICS_MK)
156 include $(LLVM_HOST_BUILD_MK)
157 endif
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800158 include $(BUILD_HOST_SHARED_LIBRARY)
159 endif
Brian Carlstrom73666be2012-03-10 20:25:10 -0800160
161 ifeq ($$(art_target_or_host),target)
162 ifeq ($$(art_ndebug_or_debug),debug)
163 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
164 else
165 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
166 endif
167 else # host
168 ifeq ($$(art_ndebug_or_debug),debug)
169 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
170 else
171 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
172 endif
173 endif
174
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800175endef
176
177# $(1): target or host
178# $(2): ndebug or debug
179define build-libart-compilers
Brian Carlstrom5644f002012-06-27 23:05:17 -0700180 $(foreach arch,arm mips x86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch))))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800181endef
182
183ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Brian Carlstrom5644f002012-06-27 23:05:17 -0700184 $(eval $(call build-libart-compiler,target,ndebug,$(TARGET_ARCH)))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800185endif
186ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Brian Carlstrom5644f002012-06-27 23:05:17 -0700187 $(eval $(call build-libart-compiler,target,debug,$(TARGET_ARCH)))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800188endif
189ifeq ($(ART_BUILD_HOST_NDEBUG),true)
190 $(eval $(call build-libart-compilers,host,ndebug))
191endif
192ifeq ($(ART_BUILD_HOST_DEBUG),true)
193 $(eval $(call build-libart-compilers,host,debug))
194endif