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 \ |
| 24 | src/compiler/codegen/RallocUtil.cc |
| 25 | |
| 26 | LIBART_COMPILER_ARM_SRC_FILES += \ |
| 27 | $(LIBART_COMPILER_COMMON_SRC_FILES) \ |
| 28 | src/compiler/codegen/arm/ArchUtility.cc \ |
| 29 | src/compiler/codegen/arm/ArmRallocUtil.cc \ |
| 30 | src/compiler/codegen/arm/Assemble.cc \ |
| 31 | src/compiler/codegen/arm/armv7-a/Codegen.cc |
| 32 | |
| 33 | LIBART_COMPILER_MIPS_SRC_FILES += \ |
| 34 | $(LIBART_COMPILER_COMMON_SRC_FILES) \ |
| 35 | src/compiler/codegen/mips/ArchUtility.cc \ |
| 36 | src/compiler/codegen/mips/MipsRallocUtil.cc \ |
| 37 | src/compiler/codegen/mips/Assemble.cc \ |
| 38 | src/compiler/codegen/mips/mips/Codegen.cc |
| 39 | |
| 40 | LIBART_COMPILER_X86_SRC_FILES += \ |
| 41 | $(LIBART_COMPILER_COMMON_SRC_FILES) \ |
| 42 | src/compiler/codegen/x86/ArchUtility.cc \ |
| 43 | src/compiler/codegen/x86/X86RallocUtil.cc \ |
| 44 | src/compiler/codegen/x86/Assemble.cc \ |
| 45 | src/compiler/codegen/x86/x86/Codegen.cc |
| 46 | |
| 47 | # $(1): target or host |
| 48 | # $(2): ndebug or debug |
| 49 | # $(3): architecture name |
| 50 | # $(4): list of source files |
| 51 | define build-libart-compiler |
| 52 | ifneq ($(1),target) |
| 53 | ifneq ($(1),host) |
| 54 | $$(error expected target or host for argument 1, received $(1)) |
| 55 | endif |
| 56 | endif |
| 57 | ifneq ($(2),ndebug) |
| 58 | ifneq ($(2),debug) |
| 59 | $$(error expected ndebug or debug for argument 2, received $(2)) |
| 60 | endif |
| 61 | endif |
| 62 | |
| 63 | art_target_or_host := $(1) |
| 64 | art_ndebug_or_debug := $(2) |
| 65 | libart_compiler_arch := $(3) |
| 66 | libart_compiler_src_files := $(4) |
| 67 | |
| 68 | include $(CLEAR_VARS) |
| 69 | ifeq ($$(art_target_or_host),target) |
| 70 | include external/stlport/libstlport.mk |
| 71 | endif |
| 72 | LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) |
| 73 | ifeq ($$(art_ndebug_or_debug),ndebug) |
| 74 | LOCAL_MODULE := libart-compiler-$(libart_compiler_arch) |
| 75 | else # debug |
| 76 | LOCAL_MODULE := libartd-compiler-$(libart_compiler_arch) |
| 77 | endif |
| 78 | |
| 79 | LOCAL_MODULE_TAGS := optional |
| 80 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES |
| 81 | |
| 82 | LOCAL_SRC_FILES := $(libart_compiler_src_files) |
| 83 | ifeq ($$(art_target_or_host),target) |
| 84 | LOCAL_CFLAGS := $(ART_TARGET_CFLAGS) |
| 85 | else # host |
| 86 | LOCAL_CFLAGS := $(ART_HOST_CFLAGS) |
| 87 | endif |
| 88 | LOCAL_SHARED_LIBRARIES := liblog |
| 89 | ifeq ($$(art_ndebug_or_debug),debug) |
| 90 | ifeq ($$(art_target_or_host),target) |
| 91 | LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) |
| 92 | else # host |
| 93 | LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS) |
| 94 | endif |
| 95 | LOCAL_SHARED_LIBRARIES += libartd |
| 96 | else |
| 97 | ifeq ($$(art_target_or_host),target) |
| 98 | LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) |
| 99 | else # host |
| 100 | LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) |
| 101 | endif |
| 102 | LOCAL_SHARED_LIBRARIES += libart |
| 103 | endif |
| 104 | |
| 105 | # TODO: temporary hack for testing. |
| 106 | ifeq ($(libart_compiler_arch),MIPS) |
| 107 | LOCAL_CFLAGS += -D__mips_hard_float |
| 108 | endif |
| 109 | |
| 110 | LOCAL_C_INCLUDES += $(ART_C_INCLUDES) |
| 111 | ifeq ($$(art_target_or_host),target) |
| 112 | LOCAL_SHARED_LIBRARIES += libstlport |
| 113 | else # host |
| 114 | LOCAL_LDLIBS := -ldl -lpthread |
| 115 | endif |
| 116 | ifeq ($$(art_target_or_host),target) |
| 117 | include $(BUILD_SHARED_LIBRARY) |
| 118 | else # host |
| 119 | LOCAL_IS_HOST_MODULE := true |
| 120 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 121 | endif |
| 122 | endef |
| 123 | |
| 124 | # $(1): target or host |
| 125 | # $(2): ndebug or debug |
| 126 | define build-libart-compilers |
| 127 | $(foreach arch,ARM MIPS X86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch),$(LIBART_COMPILER_$(arch)_SRC_FILES)))) |
| 128 | endef |
| 129 | |
| 130 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 131 | $(eval $(call build-libart-compilers,target,ndebug)) |
| 132 | endif |
| 133 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 134 | $(eval $(call build-libart-compilers,target,debug)) |
| 135 | endif |
| 136 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
| 137 | $(eval $(call build-libart-compilers,host,ndebug)) |
| 138 | endif |
| 139 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
| 140 | $(eval $(call build-libart-compilers,host,debug)) |
| 141 | endif |