Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 1 | # |
| 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 | LIBART_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 Hughes | 46f060a | 2012-03-09 17:36:50 -0800 | [diff] [blame] | 24 | src/compiler/codegen/RallocUtil.cc \ |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 25 | src/oat/jni/calling_convention.cc \ |
| 26 | src/oat/jni/jni_compiler.cc \ |
| 27 | src/oat/jni/arm/calling_convention_arm.cc \ |
| 28 | src/oat/jni/x86/calling_convention_x86.cc |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 29 | |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 30 | ifeq ($(ART_USE_QUICK_COMPILER), true) |
| 31 | LIBART_COMPILER_COMMON_SRC_FILES += \ |
| 32 | src/greenland/ir_builder.cc \ |
| 33 | src/greenland/intrinsic_helper.cc |
| 34 | endif |
| 35 | |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 36 | LIBART_COMPILER_ARM_SRC_FILES += \ |
| 37 | $(LIBART_COMPILER_COMMON_SRC_FILES) \ |
| 38 | src/compiler/codegen/arm/ArchUtility.cc \ |
| 39 | src/compiler/codegen/arm/ArmRallocUtil.cc \ |
| 40 | src/compiler/codegen/arm/Assemble.cc \ |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 41 | src/compiler/codegen/arm/armv7-a/Codegen.cc \ |
| 42 | src/oat/jni/arm/jni_internal_arm.cc |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 43 | |
| 44 | LIBART_COMPILER_MIPS_SRC_FILES += \ |
| 45 | $(LIBART_COMPILER_COMMON_SRC_FILES) \ |
| 46 | src/compiler/codegen/mips/ArchUtility.cc \ |
| 47 | src/compiler/codegen/mips/MipsRallocUtil.cc \ |
| 48 | src/compiler/codegen/mips/Assemble.cc \ |
| 49 | src/compiler/codegen/mips/mips/Codegen.cc |
| 50 | |
| 51 | LIBART_COMPILER_X86_SRC_FILES += \ |
| 52 | $(LIBART_COMPILER_COMMON_SRC_FILES) \ |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 53 | src/compiler/codegen/x86/ArchUtility.cc \ |
| 54 | src/compiler/codegen/x86/X86RallocUtil.cc \ |
| 55 | src/compiler/codegen/x86/Assemble.cc \ |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 56 | src/compiler/codegen/x86/x86/Codegen.cc \ |
| 57 | src/oat/jni/x86/jni_internal_x86.cc |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 58 | |
| 59 | # $(1): target or host |
| 60 | # $(2): ndebug or debug |
| 61 | # $(3): architecture name |
| 62 | # $(4): list of source files |
| 63 | define 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) |
| 77 | libart_compiler_arch := $(3) |
| 78 | libart_compiler_src_files := $(4) |
| 79 | |
| 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 Hughes | ceeea7d | 2012-04-10 11:35:08 -0700 | [diff] [blame] | 86 | LOCAL_MODULE := libart-compiler-$$(libart_compiler_arch) |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 87 | else # debug |
Elliott Hughes | ceeea7d | 2012-04-10 11:35:08 -0700 | [diff] [blame] | 88 | LOCAL_MODULE := libartd-compiler-$$(libart_compiler_arch) |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 89 | endif |
| 90 | |
| 91 | LOCAL_MODULE_TAGS := optional |
| 92 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES |
| 93 | |
Elliott Hughes | ceeea7d | 2012-04-10 11:35:08 -0700 | [diff] [blame] | 94 | LOCAL_SRC_FILES := $$(libart_compiler_src_files) |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 95 | ifeq ($$(art_target_or_host),target) |
| 96 | LOCAL_CFLAGS := $(ART_TARGET_CFLAGS) |
| 97 | else # host |
| 98 | LOCAL_CFLAGS := $(ART_HOST_CFLAGS) |
| 99 | endif |
Elliott Hughes | 1bac54f | 2012-03-16 12:48:31 -0700 | [diff] [blame] | 100 | |
| 101 | # TODO: clean up the compilers and remove this. |
| 102 | LOCAL_CFLAGS += -Wno-unused-parameter |
| 103 | |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 104 | LOCAL_SHARED_LIBRARIES := liblog |
| 105 | ifeq ($$(art_ndebug_or_debug),debug) |
| 106 | ifeq ($$(art_target_or_host),target) |
| 107 | LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) |
| 108 | else # host |
| 109 | LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS) |
| 110 | endif |
| 111 | LOCAL_SHARED_LIBRARIES += libartd |
| 112 | else |
| 113 | ifeq ($$(art_target_or_host),target) |
| 114 | LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) |
| 115 | else # host |
| 116 | LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) |
| 117 | endif |
| 118 | LOCAL_SHARED_LIBRARIES += libart |
| 119 | endif |
| 120 | |
| 121 | # TODO: temporary hack for testing. |
Elliott Hughes | ceeea7d | 2012-04-10 11:35:08 -0700 | [diff] [blame] | 122 | ifeq ($$(libart_compiler_arch),MIPS) |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 123 | LOCAL_CFLAGS += -D__mips_hard_float |
| 124 | endif |
| 125 | |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 126 | ifeq ($(ART_USE_QUICK_COMPILER), true) |
| 127 | LOCAL_CFLAGS += -DART_USE_QUICK_COMPILER |
| 128 | endif |
| 129 | |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 130 | LOCAL_C_INCLUDES += $(ART_C_INCLUDES) |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 131 | |
| 132 | ifeq ($(ART_USE_QUICK_COMPILER), true) |
| 133 | LOCAL_STATIC_LIBRARIES += \ |
| 134 | libLLVMBitWriter \ |
| 135 | libLLVMBitReader \ |
| 136 | libLLVMCore \ |
| 137 | libLLVMSupport |
| 138 | endif |
| 139 | |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 140 | ifeq ($$(art_target_or_host),target) |
| 141 | LOCAL_SHARED_LIBRARIES += libstlport |
| 142 | else # host |
| 143 | LOCAL_LDLIBS := -ldl -lpthread |
| 144 | endif |
| 145 | ifeq ($$(art_target_or_host),target) |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 146 | ifeq ($(ART_USE_QUICK_COMPILER), true) |
| 147 | LOCAL_SHARED_LIBRARIES += libcutils |
| 148 | include $(LLVM_GEN_INTRINSICS_MK) |
| 149 | include $(LLVM_DEVICE_BUILD_MK) |
| 150 | endif |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 151 | include $(BUILD_SHARED_LIBRARY) |
| 152 | else # host |
| 153 | LOCAL_IS_HOST_MODULE := true |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 154 | ifeq ($(ART_USE_QUICK_COMPILER), true) |
| 155 | LOCAL_STATIC_LIBRARIES += libcutils |
| 156 | include $(LLVM_GEN_INTRINSICS_MK) |
| 157 | include $(LLVM_HOST_BUILD_MK) |
| 158 | endif |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 159 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 160 | endif |
Brian Carlstrom | 73666be | 2012-03-10 20:25:10 -0800 | [diff] [blame] | 161 | |
| 162 | ifeq ($$(art_target_or_host),target) |
| 163 | ifeq ($$(art_ndebug_or_debug),debug) |
| 164 | $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE) |
| 165 | else |
| 166 | $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE) |
| 167 | endif |
| 168 | else # host |
| 169 | ifeq ($$(art_ndebug_or_debug),debug) |
| 170 | $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE) |
| 171 | else |
| 172 | $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE) |
| 173 | endif |
| 174 | endif |
| 175 | |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 176 | endef |
| 177 | |
| 178 | # $(1): target or host |
| 179 | # $(2): ndebug or debug |
| 180 | define build-libart-compilers |
| 181 | $(foreach arch,ARM MIPS X86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch),$(LIBART_COMPILER_$(arch)_SRC_FILES)))) |
| 182 | endef |
| 183 | |
| 184 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 185 | $(eval $(call build-libart-compilers,target,ndebug)) |
| 186 | endif |
| 187 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 188 | $(eval $(call build-libart-compilers,target,debug)) |
| 189 | endif |
| 190 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
| 191 | $(eval $(call build-libart-compilers,host,ndebug)) |
| 192 | endif |
| 193 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
| 194 | $(eval $(call build-libart-compilers,host,debug)) |
| 195 | endif |