blob: 994bcca31ab844b7c633e8636dea07ee4fa61a95 [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 \
jeffhao7fbee072012-08-24 17:56:54 -070028 src/oat/jni/mips/calling_convention_mips.cc \
Ian Rogers57b86d42012-03-27 16:05:41 -070029 src/oat/jni/x86/calling_convention_x86.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080030
buzbee2cfc6392012-05-07 14:51:40 -070031ifeq ($(ART_USE_QUICK_COMPILER), true)
32LIBART_COMPILER_COMMON_SRC_FILES += \
33 src/greenland/ir_builder.cc \
34 src/greenland/intrinsic_helper.cc
35endif
36
Brian Carlstrom5644f002012-06-27 23:05:17 -070037LIBART_COMPILER_arm_SRC_FILES += \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080038 $(LIBART_COMPILER_COMMON_SRC_FILES) \
39 src/compiler/codegen/arm/ArchUtility.cc \
40 src/compiler/codegen/arm/ArmRallocUtil.cc \
41 src/compiler/codegen/arm/Assemble.cc \
Ian Rogers57b86d42012-03-27 16:05:41 -070042 src/compiler/codegen/arm/armv7-a/Codegen.cc \
43 src/oat/jni/arm/jni_internal_arm.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080044
Brian Carlstrom5644f002012-06-27 23:05:17 -070045LIBART_COMPILER_mips_SRC_FILES += \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080046 $(LIBART_COMPILER_COMMON_SRC_FILES) \
47 src/compiler/codegen/mips/ArchUtility.cc \
48 src/compiler/codegen/mips/MipsRallocUtil.cc \
49 src/compiler/codegen/mips/Assemble.cc \
jeffhao7fbee072012-08-24 17:56:54 -070050 src/compiler/codegen/mips/mips/Codegen.cc \
51 src/oat/jni/mips/jni_internal_mips.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080052
Brian Carlstrom5644f002012-06-27 23:05:17 -070053LIBART_COMPILER_x86_SRC_FILES += \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080054 $(LIBART_COMPILER_COMMON_SRC_FILES) \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080055 src/compiler/codegen/x86/ArchUtility.cc \
56 src/compiler/codegen/x86/X86RallocUtil.cc \
57 src/compiler/codegen/x86/Assemble.cc \
Ian Rogers57b86d42012-03-27 16:05:41 -070058 src/compiler/codegen/x86/x86/Codegen.cc \
59 src/oat/jni/x86/jni_internal_x86.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080060
61# $(1): target or host
62# $(2): ndebug or debug
63# $(3): architecture name
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080064define build-libart-compiler
65 ifneq ($(1),target)
66 ifneq ($(1),host)
67 $$(error expected target or host for argument 1, received $(1))
68 endif
69 endif
70 ifneq ($(2),ndebug)
71 ifneq ($(2),debug)
72 $$(error expected ndebug or debug for argument 2, received $(2))
73 endif
74 endif
75
76 art_target_or_host := $(1)
77 art_ndebug_or_debug := $(2)
78 libart_compiler_arch := $(3)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080079
80 include $(CLEAR_VARS)
81 ifeq ($$(art_target_or_host),target)
82 include external/stlport/libstlport.mk
83 endif
84 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
85 ifeq ($$(art_ndebug_or_debug),ndebug)
Elliott Hughesceeea7d2012-04-10 11:35:08 -070086 LOCAL_MODULE := libart-compiler-$$(libart_compiler_arch)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080087 else # debug
Elliott Hughesceeea7d2012-04-10 11:35:08 -070088 LOCAL_MODULE := libartd-compiler-$$(libart_compiler_arch)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080089 endif
90
91 LOCAL_MODULE_TAGS := optional
92 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
93
Brian Carlstrom5644f002012-06-27 23:05:17 -070094 LOCAL_SRC_FILES := $$(LIBART_COMPILER_$$(libart_compiler_arch)_SRC_FILES)
95
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080096 ifeq ($$(art_target_or_host),target)
97 LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
98 else # host
99 LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
100 endif
Elliott Hughes1bac54f2012-03-16 12:48:31 -0700101
102 # TODO: clean up the compilers and remove this.
103 LOCAL_CFLAGS += -Wno-unused-parameter
104
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800105 LOCAL_SHARED_LIBRARIES := liblog
106 ifeq ($$(art_ndebug_or_debug),debug)
107 ifeq ($$(art_target_or_host),target)
108 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
109 else # host
110 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
111 endif
112 LOCAL_SHARED_LIBRARIES += libartd
113 else
114 ifeq ($$(art_target_or_host),target)
115 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
116 else # host
117 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
118 endif
119 LOCAL_SHARED_LIBRARIES += libart
120 endif
Shih-wei Liaocdc66902012-07-22 16:45:37 -0700121 ifeq ($(ART_USE_QUICK_COMPILER), true)
122 LOCAL_SHARED_LIBRARIES += libbcc
123 endif
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800124
125 # TODO: temporary hack for testing.
Brian Carlstrom5644f002012-06-27 23:05:17 -0700126 ifeq ($$(libart_compiler_arch),mips)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800127 LOCAL_CFLAGS += -D__mips_hard_float
128 endif
129
buzbee2cfc6392012-05-07 14:51:40 -0700130 ifeq ($(ART_USE_QUICK_COMPILER), true)
131 LOCAL_CFLAGS += -DART_USE_QUICK_COMPILER
132 endif
133
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800134 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
buzbee2cfc6392012-05-07 14:51:40 -0700135
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800136 ifeq ($$(art_target_or_host),target)
137 LOCAL_SHARED_LIBRARIES += libstlport
138 else # host
139 LOCAL_LDLIBS := -ldl -lpthread
140 endif
141 ifeq ($$(art_target_or_host),target)
buzbee2cfc6392012-05-07 14:51:40 -0700142 ifeq ($(ART_USE_QUICK_COMPILER), true)
143 LOCAL_SHARED_LIBRARIES += libcutils
144 include $(LLVM_GEN_INTRINSICS_MK)
145 include $(LLVM_DEVICE_BUILD_MK)
146 endif
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800147 include $(BUILD_SHARED_LIBRARY)
148 else # host
149 LOCAL_IS_HOST_MODULE := true
buzbee2cfc6392012-05-07 14:51:40 -0700150 ifeq ($(ART_USE_QUICK_COMPILER), true)
151 LOCAL_STATIC_LIBRARIES += libcutils
152 include $(LLVM_GEN_INTRINSICS_MK)
153 include $(LLVM_HOST_BUILD_MK)
154 endif
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800155 include $(BUILD_HOST_SHARED_LIBRARY)
156 endif
Brian Carlstrom73666be2012-03-10 20:25:10 -0800157
158 ifeq ($$(art_target_or_host),target)
159 ifeq ($$(art_ndebug_or_debug),debug)
160 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
161 else
162 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
163 endif
164 else # host
165 ifeq ($$(art_ndebug_or_debug),debug)
166 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
167 else
168 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
169 endif
170 endif
171
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800172endef
173
174# $(1): target or host
175# $(2): ndebug or debug
176define build-libart-compilers
Brian Carlstrom5644f002012-06-27 23:05:17 -0700177 $(foreach arch,arm mips x86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch))))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800178endef
179
180ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Brian Carlstrom5644f002012-06-27 23:05:17 -0700181 $(eval $(call build-libart-compiler,target,ndebug,$(TARGET_ARCH)))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800182endif
183ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Brian Carlstrom5644f002012-06-27 23:05:17 -0700184 $(eval $(call build-libart-compiler,target,debug,$(TARGET_ARCH)))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800185endif
186ifeq ($(ART_BUILD_HOST_NDEBUG),true)
187 $(eval $(call build-libart-compilers,host,ndebug))
188endif
189ifeq ($(ART_BUILD_HOST_DEBUG),true)
190 $(eval $(call build-libart-compilers,host,debug))
191endif