blob: 8084be2e9d948fc509af7e96a081291a1d33f829 [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
buzbee8c4bbb52012-11-26 14:00:58 -080017LIBART_COMPILER_SRC_FILES += \
buzbeeefc63692012-11-14 16:31:52 -080018 src/compiler/dataflow.cc \
19 src/compiler/frontend.cc \
buzbeeefc63692012-11-14 16:31:52 -080020 src/compiler/ralloc.cc \
21 src/compiler/ssa_transformation.cc \
buzbeeeaf09bc2012-11-15 14:51:41 -080022 src/compiler/compiler_utility.cc \
buzbeeefc63692012-11-14 16:31:52 -080023 src/compiler/codegen/ralloc_util.cc \
buzbee1bc37c62012-11-20 13:35:41 -080024 src/compiler/codegen/codegen_util.cc \
25 src/compiler/codegen/gen_loadstore.cc \
26 src/compiler/codegen/gen_common.cc \
27 src/compiler/codegen/gen_invoke.cc \
buzbee02031b12012-11-23 09:41:35 -080028 src/compiler/codegen/mir_to_gbc.cc \
29 src/compiler/codegen/mir_to_lir.cc \
buzbee1bc37c62012-11-20 13:35:41 -080030 src/compiler/codegen/local_optimizations.cc \
Ian Rogers57b86d42012-03-27 16:05:41 -070031 src/oat/jni/calling_convention.cc \
32 src/oat/jni/jni_compiler.cc \
33 src/oat/jni/arm/calling_convention_arm.cc \
jeffhao7fbee072012-08-24 17:56:54 -070034 src/oat/jni/mips/calling_convention_mips.cc \
buzbeec531cef2012-10-18 07:09:20 -070035 src/oat/jni/x86/calling_convention_x86.cc \
buzbee2cfc6392012-05-07 14:51:40 -070036 src/greenland/ir_builder.cc \
buzbee02031b12012-11-23 09:41:35 -080037 src/greenland/intrinsic_helper.cc \
buzbeeefc63692012-11-14 16:31:52 -080038 src/compiler/codegen/arm/target_arm.cc \
39 src/compiler/codegen/arm/assemble_arm.cc \
buzbee1bc37c62012-11-20 13:35:41 -080040 src/compiler/codegen/arm/utility_arm.cc \
41 src/compiler/codegen/arm/call_arm.cc \
42 src/compiler/codegen/arm/fp_arm.cc \
43 src/compiler/codegen/arm/int_arm.cc \
buzbeeefc63692012-11-14 16:31:52 -080044 src/compiler/codegen/mips/target_mips.cc \
45 src/compiler/codegen/mips/assemble_mips.cc \
buzbee1bc37c62012-11-20 13:35:41 -080046 src/compiler/codegen/mips/utility_mips.cc \
47 src/compiler/codegen/mips/call_mips.cc \
48 src/compiler/codegen/mips/fp_mips.cc \
49 src/compiler/codegen/mips/int_mips.cc \
buzbeeefc63692012-11-14 16:31:52 -080050 src/compiler/codegen/x86/target_x86.cc \
51 src/compiler/codegen/x86/assemble_x86.cc \
buzbee1bc37c62012-11-20 13:35:41 -080052 src/compiler/codegen/x86/utility_x86.cc \
53 src/compiler/codegen/x86/call_x86.cc \
54 src/compiler/codegen/x86/fp_x86.cc \
55 src/compiler/codegen/x86/int_x86.cc \
buzbee02031b12012-11-23 09:41:35 -080056 src/oat/jni/arm/jni_internal_arm.cc \
57 src/oat/jni/mips/jni_internal_mips.cc \
buzbee8c4bbb52012-11-26 14:00:58 -080058 src/oat/jni/x86/jni_internal_x86.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080059
60# $(1): target or host
61# $(2): ndebug or debug
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)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080076
77 include $(CLEAR_VARS)
78 ifeq ($$(art_target_or_host),target)
79 include external/stlport/libstlport.mk
80 endif
81 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
82 ifeq ($$(art_ndebug_or_debug),ndebug)
buzbee8c4bbb52012-11-26 14:00:58 -080083 LOCAL_MODULE := libart-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080084 else # debug
buzbee8c4bbb52012-11-26 14:00:58 -080085 LOCAL_MODULE := libartd-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080086 endif
87
88 LOCAL_MODULE_TAGS := optional
89 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
90
buzbee8c4bbb52012-11-26 14:00:58 -080091 LOCAL_SRC_FILES := $$(LIBART_COMPILER_SRC_FILES)
Brian Carlstrom5644f002012-06-27 23:05:17 -070092
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080093 ifeq ($$(art_target_or_host),target)
94 LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
95 else # host
96 LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
97 endif
Elliott Hughes1bac54f2012-03-16 12:48:31 -070098
99 # TODO: clean up the compilers and remove this.
100 LOCAL_CFLAGS += -Wno-unused-parameter
101
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800102 LOCAL_SHARED_LIBRARIES := liblog
103 ifeq ($$(art_ndebug_or_debug),debug)
104 ifeq ($$(art_target_or_host),target)
105 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
106 else # host
107 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
108 endif
109 LOCAL_SHARED_LIBRARIES += libartd
110 else
111 ifeq ($$(art_target_or_host),target)
112 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
113 else # host
114 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
115 endif
116 LOCAL_SHARED_LIBRARIES += libart
117 endif
buzbeec531cef2012-10-18 07:09:20 -0700118 LOCAL_SHARED_LIBRARIES += libbcc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800119
buzbeec531cef2012-10-18 07:09:20 -0700120 ifeq ($(ART_USE_PORTABLE_COMPILER),true)
121 ART_TEST_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -0700122 endif
123
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800124 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
buzbee2cfc6392012-05-07 14:51:40 -0700125
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800126 ifeq ($$(art_target_or_host),target)
127 LOCAL_SHARED_LIBRARIES += libstlport
128 else # host
129 LOCAL_LDLIBS := -ldl -lpthread
130 endif
131 ifeq ($$(art_target_or_host),target)
buzbeec531cef2012-10-18 07:09:20 -0700132 LOCAL_SHARED_LIBRARIES += libcutils
133 include $(LLVM_GEN_INTRINSICS_MK)
134 include $(LLVM_DEVICE_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800135 include $(BUILD_SHARED_LIBRARY)
136 else # host
137 LOCAL_IS_HOST_MODULE := true
buzbeec531cef2012-10-18 07:09:20 -0700138 LOCAL_STATIC_LIBRARIES += libcutils
139 include $(LLVM_GEN_INTRINSICS_MK)
140 include $(LLVM_HOST_BUILD_MK)
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800141 include $(BUILD_HOST_SHARED_LIBRARY)
142 endif
Brian Carlstrom73666be2012-03-10 20:25:10 -0800143
144 ifeq ($$(art_target_or_host),target)
145 ifeq ($$(art_ndebug_or_debug),debug)
146 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
147 else
148 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
149 endif
150 else # host
151 ifeq ($$(art_ndebug_or_debug),debug)
152 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
153 else
154 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
155 endif
156 endif
157
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800158endef
159
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800160ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800161 $(eval $(call build-libart-compiler,target,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800162endif
163ifeq ($(ART_BUILD_TARGET_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800164 $(eval $(call build-libart-compiler,target,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800165endif
166ifeq ($(ART_BUILD_HOST_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800167 $(eval $(call build-libart-compiler,host,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800168endif
169ifeq ($(ART_BUILD_HOST_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800170 $(eval $(call build-libart-compiler,host,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800171endif