blob: 9baef696e943ce3d08eb252b25c07de04fe58684 [file] [log] [blame]
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -07001#
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
17
18LIBART_COMPILER_GREENLAND_CFLAGS := -DART_USE_GREENLAND_COMPILER=1
19
20LIBART_COMPILER_GREENLAND_SRC_FILES += \
TDYa12789f96052012-07-12 20:49:53 -070021 src/greenland/inferred_reg_category_map.cc \
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070022 src/greenland/dalvik_reg.cc \
23 src/greenland/dex_lang.cc \
Shih-wei Liao21d28f52012-06-12 05:55:00 -070024 src/greenland/gbc_context.cc \
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070025 src/greenland/greenland.cc \
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070026 src/greenland/intrinsic_helper.cc \
Shih-wei Liao21d28f52012-06-12 05:55:00 -070027 src/greenland/register_allocator.cc \
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070028 src/greenland/target_codegen_machine.cc \
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070029 src/greenland/target_registry.cc \
30 src/oat/jni/calling_convention.cc \
31 src/oat/jni/jni_compiler.cc \
32 src/oat/jni/arm/calling_convention_arm.cc \
jeffhao7fbee072012-08-24 17:56:54 -070033 src/oat/jni/mips/calling_convention_mips.cc \
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070034 src/oat/jni/x86/calling_convention_x86.cc
35
Brian Carlstrom5644f002012-06-27 23:05:17 -070036LIBART_COMPILER_GREENLAND_arm_SRC_FILES += \
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070037 src/greenland/arm/arm_codegen_machine.cc \
38 src/greenland/arm/arm_invoke_stub_compiler.cc
39
Brian Carlstrom5644f002012-06-27 23:05:17 -070040LIBART_COMPILER_GREENLAND_mips_SRC_FILES += \
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070041 src/greenland/mips/mips_codegen_machine.cc \
42 src/greenland/mips/mips_invoke_stub_compiler.cc
43
Brian Carlstrom5644f002012-06-27 23:05:17 -070044LIBART_COMPILER_GREENLAND_x86_SRC_FILES += \
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070045 src/greenland/x86/x86_codegen_machine.cc \
46 src/greenland/x86/x86_lir_emitter.cc \
47 src/greenland/x86/x86_lir_info.cc \
48 src/greenland/x86/x86_invoke_stub_compiler.cc
49
Shih-wei Liao21d28f52012-06-12 05:55:00 -070050########################################################################
51
52include $(CLEAR_VARS)
53LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
54LOCAL_MODULE := target_lir_builder_generator
55LOCAL_MODULE_TAGS := optional
56LOCAL_IS_HOST_MODULE := true
57LOCAL_SRC_FILES := src/greenland/tools/target_lir_builder_generator.cc
58LOCAL_CFLAGS := $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
59LOCAL_C_INCLUDES := $(ART_C_INCLUDES)
60include $(BUILD_HOST_EXECUTABLE)
61TARGET_LIR_BUILDER_GENERATOR := $(LOCAL_BUILT_MODULE)
62
63########################################################################
64
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070065# $(1): target or host
66# $(2): ndebug or debug
67define build-libart-compiler-greenland
68 ifneq ($(1),target)
69 ifneq ($(1),host)
70 $$(error expected target or host for argument 1, received $(1))
71 endif
72 endif
73 ifneq ($(2),ndebug)
74 ifneq ($(2),debug)
75 $$(error expected ndebug or debug for argument 2, received $(2))
76 endif
77 endif
78
79 art_target_or_host := $(1)
80 art_ndebug_or_debug := $(2)
81
82 include $(CLEAR_VARS)
83 ifeq ($$(art_target_or_host),target)
84 include external/stlport/libstlport.mk
85 endif
86 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
87 ifeq ($$(art_ndebug_or_debug),ndebug)
88 LOCAL_MODULE := libart-compiler-greenland
89 else # debug
90 LOCAL_MODULE := libartd-compiler-greenland
91 endif
92
93 LOCAL_MODULE_TAGS := optional
94 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
95
96 LOCAL_SRC_FILES := $(LIBART_COMPILER_GREENLAND_SRC_FILES)
97 LOCAL_CFLAGS := $(LIBART_COMPILER_GREENLAND_CFLAGS)
98 ifeq ($$(art_target_or_host),target)
99 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
100 else # host
Shih-wei Liao21d28f52012-06-12 05:55:00 -0700101 LOCAL_IS_HOST_MODULE := true
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700102 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
103 endif
104
105 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
106
107 ifeq ($$(art_target_or_host),target)
Shih-wei Liao21d28f52012-06-12 05:55:00 -0700108 ENUM_INCLUDE_LIR_TARGETS := arm
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700109 LOCAL_SRC_FILES += \
Brian Carlstrom5644f002012-06-27 23:05:17 -0700110 $(LIBART_COMPILER_GREENLAND_$(TARGET_ARCH)_SRC_FILES)
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700111 else
Shih-wei Liao21d28f52012-06-12 05:55:00 -0700112 ENUM_INCLUDE_LIR_TARGETS := arm mips x86
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700113 LOCAL_SRC_FILES += \
Brian Carlstrom5644f002012-06-27 23:05:17 -0700114 $(LIBART_COMPILER_GREENLAND_arm_SRC_FILES) \
115 $(LIBART_COMPILER_GREENLAND_mips_SRC_FILES) \
116 $(LIBART_COMPILER_GREENLAND_x86_SRC_FILES)
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700117 endif
118
Shih-wei Liao21d28f52012-06-12 05:55:00 -0700119 GENERATED_SRC_DIR := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),$$(LOCAL_IS_HOST_MODULE),)
120 ENUM_TARGEET_LIR_BUILDER_INC_FILES := $$(foreach lir_target, $$(ENUM_INCLUDE_LIR_TARGETS), $$(lir_target)_lir_builder_base.inc)
121 ENUM_TARGET_LIR_BUILDER_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/, $$(ENUM_TARGEET_LIR_BUILDER_INC_FILES))
122
123$$(ENUM_TARGET_LIR_BUILDER_OUT_GEN): PRIVATE_LIR_TARGET = $$(subst _lir_builder_base.inc,,$$(notdir $$@))
124$$(ENUM_TARGET_LIR_BUILDER_OUT_GEN): %.inc : $$(TARGET_LIR_BUILDER_GENERATOR)
125 @echo "target Generated: $$@"
126 $$(hide) $$(TARGET_LIR_BUILDER_GENERATOR) $$(PRIVATE_LIR_TARGET) > $$@
127
128LOCAL_GENERATED_SOURCES += $$(ENUM_TARGET_LIR_BUILDER_OUT_GEN)
129
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700130 LOCAL_STATIC_LIBRARIES += \
131 libLLVMBitWriter \
132 libLLVMBitReader \
133 libLLVMScalarOpts \
134 libLLVMInstCombine \
135 libLLVMTransformUtils \
136 libLLVMAnalysis \
137 libLLVMTarget \
138 libLLVMCore \
139 libLLVMSupport
140 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
141 ifeq ($$(art_target_or_host),target)
142 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
143 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
Shih-wei Liao21d28f52012-06-12 05:55:00 -0700144 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700145 else # host
146 LOCAL_STATIC_LIBRARIES += libcutils
147 LOCAL_SHARED_LIBRARIES += libz-host
148 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
149 LOCAL_LDLIBS := -ldl -lpthread
150 ifeq ($(HOST_OS),linux)
151 LOCAL_LDLIBS += -lrt
152 endif
153 endif
154 ifeq ($$(art_ndebug_or_debug),debug)
155 ifeq ($$(art_target_or_host),target)
156 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
157 else # host
158 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
159 endif
160 LOCAL_SHARED_LIBRARIES += libartd
161 else
162 ifeq ($$(art_target_or_host),target)
163 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
164 else # host
165 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
166 endif
167 LOCAL_SHARED_LIBRARIES += libart
168 endif
169 ifeq ($$(art_target_or_host),target)
170 include $(LLVM_GEN_INTRINSICS_MK)
171 include $(LLVM_DEVICE_BUILD_MK)
172 include $(BUILD_SHARED_LIBRARY)
173 else # host
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700174 include $(LLVM_GEN_INTRINSICS_MK)
175 include $(LLVM_HOST_BUILD_MK)
176 include $(BUILD_HOST_SHARED_LIBRARY)
177 endif
178
179 ifeq ($$(art_target_or_host),target)
180 ifeq ($$(art_ndebug_or_debug),debug)
181 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
182 else
183 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
184 endif
185 else # host
186 ifeq ($$(art_ndebug_or_debug),debug)
187 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
188 else
189 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
190 endif
191 endif
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700192endef
193
Shih-wei Liao21d28f52012-06-12 05:55:00 -0700194
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700195ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
196 $(eval $(call build-libart-compiler-greenland,target,ndebug))
197endif
198ifeq ($(ART_BUILD_TARGET_DEBUG),true)
199 $(eval $(call build-libart-compiler-greenland,target,debug))
200endif
201ifeq ($(ART_BUILD_HOST_NDEBUG),true)
202 $(eval $(call build-libart-compiler-greenland,host,ndebug))
203endif
204ifeq ($(ART_BUILD_HOST_DEBUG),true)
205 $(eval $(call build-libart-compiler-greenland,host,debug))
206endif