blob: 829dd6a683ddf424c2da9a15114064f9cb02f771 [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 \
buzbee2502e002012-12-31 16:05:53 -080021 src/compiler/bb_opt.cc \
buzbeeefc63692012-11-14 16:31:52 -080022 src/compiler/ssa_transformation.cc \
buzbeeeaf09bc2012-11-15 14:51:41 -080023 src/compiler/compiler_utility.cc \
buzbeeefc63692012-11-14 16:31:52 -080024 src/compiler/codegen/ralloc_util.cc \
buzbee1bc37c62012-11-20 13:35:41 -080025 src/compiler/codegen/codegen_util.cc \
26 src/compiler/codegen/gen_loadstore.cc \
27 src/compiler/codegen/gen_common.cc \
28 src/compiler/codegen/gen_invoke.cc \
buzbee02031b12012-11-23 09:41:35 -080029 src/compiler/codegen/mir_to_gbc.cc \
30 src/compiler/codegen/mir_to_lir.cc \
buzbee1bc37c62012-11-20 13:35:41 -080031 src/compiler/codegen/local_optimizations.cc \
Ian Rogers57b86d42012-03-27 16:05:41 -070032 src/oat/jni/calling_convention.cc \
33 src/oat/jni/jni_compiler.cc \
34 src/oat/jni/arm/calling_convention_arm.cc \
jeffhao7fbee072012-08-24 17:56:54 -070035 src/oat/jni/mips/calling_convention_mips.cc \
buzbeec531cef2012-10-18 07:09:20 -070036 src/oat/jni/x86/calling_convention_x86.cc \
buzbee2cfc6392012-05-07 14:51:40 -070037 src/greenland/ir_builder.cc \
buzbee02031b12012-11-23 09:41:35 -080038 src/greenland/intrinsic_helper.cc \
buzbeeefc63692012-11-14 16:31:52 -080039 src/compiler/codegen/arm/target_arm.cc \
40 src/compiler/codegen/arm/assemble_arm.cc \
buzbee1bc37c62012-11-20 13:35:41 -080041 src/compiler/codegen/arm/utility_arm.cc \
42 src/compiler/codegen/arm/call_arm.cc \
43 src/compiler/codegen/arm/fp_arm.cc \
44 src/compiler/codegen/arm/int_arm.cc \
buzbeeefc63692012-11-14 16:31:52 -080045 src/compiler/codegen/mips/target_mips.cc \
46 src/compiler/codegen/mips/assemble_mips.cc \
buzbee1bc37c62012-11-20 13:35:41 -080047 src/compiler/codegen/mips/utility_mips.cc \
48 src/compiler/codegen/mips/call_mips.cc \
49 src/compiler/codegen/mips/fp_mips.cc \
50 src/compiler/codegen/mips/int_mips.cc \
buzbeeefc63692012-11-14 16:31:52 -080051 src/compiler/codegen/x86/target_x86.cc \
52 src/compiler/codegen/x86/assemble_x86.cc \
buzbee1bc37c62012-11-20 13:35:41 -080053 src/compiler/codegen/x86/utility_x86.cc \
54 src/compiler/codegen/x86/call_x86.cc \
55 src/compiler/codegen/x86/fp_x86.cc \
56 src/compiler/codegen/x86/int_x86.cc \
buzbee02031b12012-11-23 09:41:35 -080057 src/oat/jni/arm/jni_internal_arm.cc \
58 src/oat/jni/mips/jni_internal_mips.cc \
buzbee8c4bbb52012-11-26 14:00:58 -080059 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
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080063define build-libart-compiler
64 ifneq ($(1),target)
65 ifneq ($(1),host)
66 $$(error expected target or host for argument 1, received $(1))
67 endif
68 endif
69 ifneq ($(2),ndebug)
70 ifneq ($(2),debug)
71 $$(error expected ndebug or debug for argument 2, received $(2))
72 endif
73 endif
74
75 art_target_or_host := $(1)
76 art_ndebug_or_debug := $(2)
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)
buzbee8c4bbb52012-11-26 14:00:58 -080084 LOCAL_MODULE := libart-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080085 else # debug
buzbee8c4bbb52012-11-26 14:00:58 -080086 LOCAL_MODULE := libartd-compiler
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080087 endif
88
89 LOCAL_MODULE_TAGS := optional
90 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
91
buzbee8c4bbb52012-11-26 14:00:58 -080092 LOCAL_SRC_FILES := $$(LIBART_COMPILER_SRC_FILES)
Brian Carlstrom5644f002012-06-27 23:05:17 -070093
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
buzbeec531cef2012-10-18 07:09:20 -0700119 LOCAL_SHARED_LIBRARIES += libbcc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800120
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
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800161ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800162 $(eval $(call build-libart-compiler,target,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800163endif
164ifeq ($(ART_BUILD_TARGET_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800165 $(eval $(call build-libart-compiler,target,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800166endif
167ifeq ($(ART_BUILD_HOST_NDEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800168 $(eval $(call build-libart-compiler,host,ndebug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800169endif
170ifeq ($(ART_BUILD_HOST_DEBUG),true)
buzbee8c4bbb52012-11-26 14:00:58 -0800171 $(eval $(call build-libart-compiler,host,debug))
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800172endif