Carl Shapiro | 7b21670 | 2011-06-17 15:09:26 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2011 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 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame^] | 17 | LIBART_CFLAGS := |
| 18 | ifeq ($(ART_USE_LLVM_COMPILER),true) |
| 19 | LIBART_CFLAGS += -DART_USE_LLVM_COMPILER=1 |
| 20 | endif |
| 21 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 22 | # $(1): target or host |
| 23 | # $(2): ndebug or debug |
| 24 | define build-libart |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 25 | ifneq ($(1),target) |
| 26 | ifneq ($(1),host) |
| 27 | $$(error expected target or host for argument 1, received $(1)) |
| 28 | endif |
| 29 | endif |
| 30 | ifneq ($(2),ndebug) |
| 31 | ifneq ($(2),debug) |
| 32 | $$(error expected ndebug or debug for argument 2, received $(2)) |
| 33 | endif |
| 34 | endif |
| 35 | |
| 36 | art_target_or_host := $(1) |
| 37 | art_ndebug_or_debug := $(2) |
| 38 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 39 | include $(CLEAR_VARS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 40 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 41 | include external/stlport/libstlport.mk |
| 42 | endif |
| 43 | LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 44 | ifeq ($$(art_ndebug_or_debug),ndebug) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 45 | LOCAL_MODULE := libart |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 46 | else # debug |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 47 | LOCAL_MODULE := libartd |
| 48 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 49 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 50 | LOCAL_MODULE_TAGS := optional |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 51 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES |
| 52 | |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 53 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 54 | LOCAL_SRC_FILES := $(LIBART_TARGET_SRC_FILES) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 55 | else # host |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 56 | LOCAL_SRC_FILES := $(LIBART_HOST_SRC_FILES) |
| 57 | endif |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame^] | 58 | |
| 59 | LOCAL_CFLAGS := $(LIBART_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 60 | ifeq ($$(art_target_or_host),target) |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame^] | 61 | LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 62 | else # host |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame^] | 63 | LOCAL_CFLAGS += $(ART_HOST_CFLAGS) |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 64 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 65 | ifeq ($$(art_ndebug_or_debug),debug) |
| 66 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 67 | LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 68 | else # host |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 69 | LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS) |
Brian Carlstrom | 08125a0 | 2011-09-16 14:55:51 -0700 | [diff] [blame] | 70 | LOCAL_STATIC_LIBRARIES := libgtest_host |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 71 | endif |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 72 | else |
| 73 | ifeq ($$(art_target_or_host),target) |
| 74 | LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) |
| 75 | else # host |
| 76 | LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) |
| 77 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 78 | endif |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 79 | LOCAL_C_INCLUDES += $(ART_C_INCLUDES) |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 80 | ifeq ($(ART_USE_LLVM_COMPILER),true) |
Shih-wei Liao | 5b8b1ed | 2012-02-23 23:48:21 -0800 | [diff] [blame] | 81 | LOCAL_C_INCLUDES += frameworks/compile/linkloader |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame^] | 82 | LOCAL_STATIC_LIBRARIES += librsloader |
Logan Chien | 8b977d3 | 2012-02-21 19:14:55 +0800 | [diff] [blame] | 83 | libart_arm_STATIC_LIBRARIES := \ |
| 84 | libLLVMARMInfo \ |
| 85 | libLLVMARMDisassembler \ |
| 86 | libLLVMARMAsmParser \ |
| 87 | libLLVMARMAsmPrinter \ |
| 88 | libLLVMARMCodeGen \ |
| 89 | libLLVMARMDesc |
| 90 | |
| 91 | libart_mips_STATIC_LIBRARIES := \ |
| 92 | libLLVMMipsInfo \ |
| 93 | libLLVMMipsCodeGen \ |
| 94 | libLLVMMipsDesc \ |
| 95 | libLLVMMipsAsmPrinter \ |
| 96 | |
| 97 | libart_x86_STATIC_LIBRARIES := \ |
| 98 | libLLVMX86Info \ |
| 99 | libLLVMX86AsmParser \ |
| 100 | libLLVMX86CodeGen \ |
| 101 | libLLVMX86Disassembler \ |
| 102 | libLLVMX86Desc \ |
| 103 | libLLVMX86AsmPrinter \ |
| 104 | libLLVMX86Utils |
| 105 | |
| 106 | ifeq ($$(art_target_or_host),target) |
| 107 | LOCAL_STATIC_LIBRARIES += \ |
| 108 | $$(libart_arm_STATIC_LIBRARIES) |
| 109 | else |
| 110 | LOCAL_STATIC_LIBRARIES += \ |
| 111 | $$(libart_arm_STATIC_LIBRARIES) \ |
| 112 | $$(libart_mips_STATIC_LIBRARIES) \ |
| 113 | $$(libart_x86_STATIC_LIBRARIES) |
| 114 | endif |
| 115 | |
| 116 | LOCAL_STATIC_LIBRARIES += \ |
| 117 | libLLVMLinker \ |
| 118 | libLLVMipo \ |
| 119 | libLLVMBitWriter \ |
| 120 | libLLVMBitReader \ |
| 121 | libLLVMAsmPrinter \ |
| 122 | libLLVMSelectionDAG \ |
| 123 | libLLVMCodeGen \ |
| 124 | libLLVMScalarOpts \ |
| 125 | libLLVMInstCombine \ |
| 126 | libLLVMInstrumentation \ |
| 127 | libLLVMTransformUtils \ |
| 128 | libLLVMipa \ |
| 129 | libLLVMAnalysis \ |
| 130 | libLLVMTarget \ |
| 131 | libLLVMMC \ |
| 132 | libLLVMMCParser \ |
| 133 | libLLVMCore \ |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame^] | 134 | libLLVMSupport |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 135 | endif |
Elliott Hughes | 18c0753 | 2011-08-18 15:50:51 -0700 | [diff] [blame] | 136 | LOCAL_SHARED_LIBRARIES := liblog libnativehelper |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 137 | ifeq ($$(art_target_or_host),target) |
Elliott Hughes | ffb465f | 2012-03-01 18:46:05 -0800 | [diff] [blame] | 138 | LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl |
| 139 | LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support |
| 140 | LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 141 | else # host |
Elliott Hughes | 6c9c06d | 2011-11-07 16:43:47 -0800 | [diff] [blame] | 142 | LOCAL_STATIC_LIBRARIES += libcutils |
Elliott Hughes | ffb465f | 2012-03-01 18:46:05 -0800 | [diff] [blame] | 143 | LOCAL_SHARED_LIBRARIES += libz-host |
| 144 | LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support |
Elliott Hughes | ad6c9c3 | 2012-01-19 17:39:12 -0800 | [diff] [blame] | 145 | LOCAL_LDLIBS := -ldl -lpthread |
| 146 | ifeq ($(HOST_OS),linux) |
| 147 | LOCAL_LDLIBS += -lrt |
| 148 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 149 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 150 | ifeq ($$(art_target_or_host),target) |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 151 | ifeq ($(ART_USE_LLVM_COMPILER),true) |
| 152 | include $(LLVM_GEN_INTRINSICS_MK) |
| 153 | include $(LLVM_DEVICE_BUILD_MK) |
| 154 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 155 | include $(BUILD_SHARED_LIBRARY) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 156 | else # host |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 157 | LOCAL_IS_HOST_MODULE := true |
| 158 | ifeq ($(ART_USE_LLVM_COMPILER),true) |
| 159 | include $(LLVM_GEN_INTRINSICS_MK) |
| 160 | include $(LLVM_HOST_BUILD_MK) |
| 161 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 162 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 163 | endif |
| 164 | endef |
| 165 | |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 166 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 167 | $(eval $(call build-libart,target,ndebug)) |
| 168 | endif |
| 169 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 170 | $(eval $(call build-libart,target,debug)) |
| 171 | endif |
| 172 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 173 | $(eval $(call build-libart,host,ndebug)) |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 174 | endif |
| 175 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 176 | $(eval $(call build-libart,host,debug)) |
| 177 | endif |