blob: fa51a9920e1d810e48ae74eb766abf42e966bc9f [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 += \
buzbeeefc63692012-11-14 16:31:52 -080018 src/compiler/dataflow.cc \
19 src/compiler/frontend.cc \
20 src/compiler/intermediate_rep.cc \
21 src/compiler/ralloc.cc \
22 src/compiler/ssa_transformation.cc \
23 src/compiler/utility.cc \
24 src/compiler/codegen/ralloc_util.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 \
buzbeec531cef2012-10-18 07:09:20 -070029 src/oat/jni/x86/calling_convention_x86.cc \
buzbee2cfc6392012-05-07 14:51:40 -070030 src/greenland/ir_builder.cc \
31 src/greenland/intrinsic_helper.cc
buzbee2cfc6392012-05-07 14:51:40 -070032
Brian Carlstrom5644f002012-06-27 23:05:17 -070033LIBART_COMPILER_arm_SRC_FILES += \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080034 $(LIBART_COMPILER_COMMON_SRC_FILES) \
buzbeeefc63692012-11-14 16:31:52 -080035 src/compiler/codegen/arm/target_arm.cc \
36 src/compiler/codegen/arm/assemble_arm.cc \
37 src/compiler/codegen/arm/backend_arm.cc \
Ian Rogers57b86d42012-03-27 16:05:41 -070038 src/oat/jni/arm/jni_internal_arm.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080039
Brian Carlstrom5644f002012-06-27 23:05:17 -070040LIBART_COMPILER_mips_SRC_FILES += \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080041 $(LIBART_COMPILER_COMMON_SRC_FILES) \
buzbeeefc63692012-11-14 16:31:52 -080042 src/compiler/codegen/mips/target_mips.cc \
43 src/compiler/codegen/mips/assemble_mips.cc \
44 src/compiler/codegen/mips/backend_mips.cc \
jeffhao7fbee072012-08-24 17:56:54 -070045 src/oat/jni/mips/jni_internal_mips.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080046
Brian Carlstrom5644f002012-06-27 23:05:17 -070047LIBART_COMPILER_x86_SRC_FILES += \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080048 $(LIBART_COMPILER_COMMON_SRC_FILES) \
buzbeeefc63692012-11-14 16:31:52 -080049 src/compiler/codegen/x86/target_x86.cc \
50 src/compiler/codegen/x86/assemble_x86.cc \
51 src/compiler/codegen/x86/backend_x86.cc \
Ian Rogers57b86d42012-03-27 16:05:41 -070052 src/oat/jni/x86/jni_internal_x86.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080053
54# $(1): target or host
55# $(2): ndebug or debug
56# $(3): architecture name
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080057define build-libart-compiler
58 ifneq ($(1),target)
59 ifneq ($(1),host)
60 $$(error expected target or host for argument 1, received $(1))
61 endif
62 endif
63 ifneq ($(2),ndebug)
64 ifneq ($(2),debug)
65 $$(error expected ndebug or debug for argument 2, received $(2))
66 endif
67 endif
68
69 art_target_or_host := $(1)
70 art_ndebug_or_debug := $(2)
71 libart_compiler_arch := $(3)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080072
73 include $(CLEAR_VARS)
74 ifeq ($$(art_target_or_host),target)
75 include external/stlport/libstlport.mk
76 endif
77 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
78 ifeq ($$(art_ndebug_or_debug),ndebug)
Elliott Hughesceeea7d2012-04-10 11:35:08 -070079 LOCAL_MODULE := libart-compiler-$$(libart_compiler_arch)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080080 else # debug
Elliott Hughesceeea7d2012-04-10 11:35:08 -070081 LOCAL_MODULE := libartd-compiler-$$(libart_compiler_arch)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080082 endif
83
84 LOCAL_MODULE_TAGS := optional
85 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
86
Brian Carlstrom5644f002012-06-27 23:05:17 -070087 LOCAL_SRC_FILES := $$(LIBART_COMPILER_$$(libart_compiler_arch)_SRC_FILES)
88
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080089 ifeq ($$(art_target_or_host),target)
90 LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
91 else # host
92 LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
93 endif
Elliott Hughes1bac54f2012-03-16 12:48:31 -070094
95 # TODO: clean up the compilers and remove this.
96 LOCAL_CFLAGS += -Wno-unused-parameter
97
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080098 LOCAL_SHARED_LIBRARIES := liblog
99 ifeq ($$(art_ndebug_or_debug),debug)
100 ifeq ($$(art_target_or_host),target)
101 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
102 else # host
103 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
104 endif
105 LOCAL_SHARED_LIBRARIES += libartd
106 else
107 ifeq ($$(art_target_or_host),target)
108 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
109 else # host
110 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
111 endif
112 LOCAL_SHARED_LIBRARIES += libart
113 endif
buzbeec531cef2012-10-18 07:09:20 -0700114 LOCAL_SHARED_LIBRARIES += libbcc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800115
116 # TODO: temporary hack for testing.
Brian Carlstrom5644f002012-06-27 23:05:17 -0700117 ifeq ($$(libart_compiler_arch),mips)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800118 LOCAL_CFLAGS += -D__mips_hard_float
119 endif
120
buzbeec531cef2012-10-18 07:09:20 -0700121 ifeq ($(ART_USE_PORTABLE_COMPILER),true)
122 ART_TEST_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -0700123 endif
124
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800125 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
buzbee2cfc6392012-05-07 14:51:40 -0700126
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800127 ifeq ($$(art_target_or_host),target)
128 LOCAL_SHARED_LIBRARIES += libstlport
129 else # host
130 LOCAL_LDLIBS := -ldl -lpthread
131 endif
132 ifeq ($$(art_target_or_host),target)
buzbeec531cef2012-10-18 07:09:20 -0700133 LOCAL_SHARED_LIBRARIES += libcutils
134 include $(LLVM_GEN_INTRINSICS_MK)
135 include $(LLVM_DEVICE_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800136 include $(BUILD_SHARED_LIBRARY)
137 else # host
138 LOCAL_IS_HOST_MODULE := true
buzbeec531cef2012-10-18 07:09:20 -0700139 LOCAL_STATIC_LIBRARIES += libcutils
140 include $(LLVM_GEN_INTRINSICS_MK)
141 include $(LLVM_HOST_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800142 include $(BUILD_HOST_SHARED_LIBRARY)
143 endif
Brian Carlstrom73666be2012-03-10 20:25:10 -0800144
145 ifeq ($$(art_target_or_host),target)
146 ifeq ($$(art_ndebug_or_debug),debug)
147 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
148 else
149 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
150 endif
151 else # host
152 ifeq ($$(art_ndebug_or_debug),debug)
153 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
154 else
155 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
156 endif
157 endif
158
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800159endef
160
161# $(1): target or host
162# $(2): ndebug or debug
163define build-libart-compilers
Brian Carlstrom5644f002012-06-27 23:05:17 -0700164 $(foreach arch,arm mips x86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch))))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800165endef
166
167ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Brian Carlstrom5644f002012-06-27 23:05:17 -0700168 $(eval $(call build-libart-compiler,target,ndebug,$(TARGET_ARCH)))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800169endif
170ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Brian Carlstrom5644f002012-06-27 23:05:17 -0700171 $(eval $(call build-libart-compiler,target,debug,$(TARGET_ARCH)))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800172endif
173ifeq ($(ART_BUILD_HOST_NDEBUG),true)
174 $(eval $(call build-libart-compilers,host,ndebug))
175endif
176ifeq ($(ART_BUILD_HOST_DEBUG),true)
177 $(eval $(call build-libart-compilers,host,debug))
178endif