Zonr Chang | 932648d | 2010-10-13 22:23:56 +0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2010 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 | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 17 | LOCAL_PATH := $(call my-dir) |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 18 | include $(LOCAL_PATH)/libbcc-config.mk |
Logan | 3584900 | 2011-01-15 07:30:43 +0800 | [diff] [blame] | 19 | |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 20 | |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 21 | #===================================================================== |
| 22 | # Whole Static Library to Be Linked In |
| 23 | #===================================================================== |
Logan | 3584900 | 2011-01-15 07:30:43 +0800 | [diff] [blame] | 24 | |
Logan Chien | da5e0c3 | 2011-06-13 03:47:21 +0800 | [diff] [blame] | 25 | ifeq ($(libbcc_USE_OLD_JIT),1) |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 26 | libbcc_WHOLE_STATIC_LIBRARIES += libbccCodeGen |
Logan Chien | da5e0c3 | 2011-06-13 03:47:21 +0800 | [diff] [blame] | 27 | endif |
| 28 | |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 29 | ifeq ($(libbcc_USE_DISASSEMBLER),1) |
| 30 | libbcc_WHOLE_STATIC_LIBRARIES += libbccDisassembler |
Logan | 3584900 | 2011-01-15 07:30:43 +0800 | [diff] [blame] | 31 | endif |
Logan | cf3e521 | 2010-12-29 01:44:55 +0800 | [diff] [blame] | 32 | |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 33 | libbcc_WHOLE_STATIC_LIBRARIES += \ |
| 34 | libbccExecutionEngine \ |
| 35 | libbccHelper |
Logan Chien | 8d3b5e1 | 2011-07-12 16:19:21 +0800 | [diff] [blame] | 36 | |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 37 | |
| 38 | #===================================================================== |
Joseph Wen | 2ca6e57 | 2011-06-24 14:12:23 -0700 | [diff] [blame] | 39 | # Calculate SHA1 checksum for libbcc.so and libRS.so |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 40 | #===================================================================== |
| 41 | |
Joseph Wen | 2ca6e57 | 2011-06-24 14:12:23 -0700 | [diff] [blame] | 42 | include $(CLEAR_VARS) |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 43 | |
Ying Wang | 26fea10 | 2011-07-05 15:12:25 -0700 | [diff] [blame] | 44 | LOCAL_MODULE := libbcc.so.sha1 |
Joseph Wen | 2ca6e57 | 2011-06-24 14:12:23 -0700 | [diff] [blame] | 45 | LOCAL_MODULE_TAGS := optional |
| 46 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES |
| 47 | |
Ying Wang | 26fea10 | 2011-07-05 15:12:25 -0700 | [diff] [blame] | 48 | include $(BUILD_SYSTEM)/base_rules.mk |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 49 | libbcc_SHA1_SRCS := \ |
| 50 | $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libbcc.so \ |
| 51 | $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRS.so |
Ying Wang | 0b48695 | 2011-07-01 13:37:01 -0700 | [diff] [blame] | 52 | |
Logan Chien | 6888aae | 2011-07-12 16:47:10 +0800 | [diff] [blame] | 53 | libbcc_GEN_SHA1_STAMP := $(LOCAL_PATH)/tools/gen-sha1-stamp.py |
| 54 | |
Ying Wang | 26fea10 | 2011-07-05 15:12:25 -0700 | [diff] [blame] | 55 | $(LOCAL_BUILT_MODULE): PRIVATE_SHA1_SRCS := $(libbcc_SHA1_SRCS) |
Logan Chien | 6888aae | 2011-07-12 16:47:10 +0800 | [diff] [blame] | 56 | $(LOCAL_BUILT_MODULE): $(libbcc_SHA1_SRCS) $(libbcc_GEN_SHA1_STAMP) |
Ying Wang | 0b48695 | 2011-07-01 13:37:01 -0700 | [diff] [blame] | 57 | $(hide) mkdir -p $(dir $@) && \ |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 58 | $(libbcc_GEN_SHA1_STAMP) $@ $(PRIVATE_SHA1_SRCS) |
Joseph Wen | 2ca6e57 | 2011-06-24 14:12:23 -0700 | [diff] [blame] | 59 | |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 60 | |
| 61 | #===================================================================== |
| 62 | # Device Shared Library libbcc |
| 63 | #===================================================================== |
| 64 | |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 65 | include $(CLEAR_VARS) |
Iliyan Malchev | 97bd44d | 2011-03-14 14:02:14 -0700 | [diff] [blame] | 66 | |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 67 | LOCAL_MODULE := libbcc |
Zonr Chang | 932648d | 2010-10-13 22:23:56 +0800 | [diff] [blame] | 68 | LOCAL_MODULE_TAGS := optional |
Joseph Wen | 5de1adf | 2011-06-21 15:41:31 -0700 | [diff] [blame] | 69 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 70 | |
Logan Chien | f68882e | 2011-07-18 19:11:39 +0800 | [diff] [blame] | 71 | LOCAL_CFLAGS := $(libbcc_CFLAGS) |
| 72 | LOCAL_C_INCLUDES := $(libbcc_C_INCLUDES) |
| 73 | |
| 74 | LOCAL_SRC_FILES := lib/ExecutionEngine/bcc.cpp |
| 75 | |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 76 | LOCAL_WHOLE_STATIC_LIBRARIES += \ |
| 77 | $(libbcc_WHOLE_STATIC_LIBRARIES) \ |
| 78 | libbccCompilerRT |
Kenny Root | 34678ab | 2011-02-07 10:56:27 -0800 | [diff] [blame] | 79 | |
Shih-wei Liao | ddfd1ad | 2011-06-18 01:47:27 -0700 | [diff] [blame] | 80 | ifeq ($(libbcc_USE_MCJIT),1) |
Shih-wei Liao | be857c0 | 2011-06-19 11:51:17 -0700 | [diff] [blame] | 81 | LOCAL_STATIC_LIBRARIES += librsloader |
Shih-wei Liao | ddfd1ad | 2011-06-18 01:47:27 -0700 | [diff] [blame] | 82 | endif |
| 83 | |
Logan | 3584900 | 2011-01-15 07:30:43 +0800 | [diff] [blame] | 84 | ifeq ($(libbcc_USE_DISASSEMBLER),1) |
Kenny Root | 34678ab | 2011-02-07 10:56:27 -0800 | [diff] [blame] | 85 | ifeq ($(TARGET_ARCH),arm) |
| 86 | LOCAL_STATIC_LIBRARIES += \ |
| 87 | libLLVMARMDisassembler \ |
| 88 | libLLVMARMAsmPrinter |
| 89 | else |
| 90 | ifeq ($(TARGET_ARCH),x86) |
| 91 | LOCAL_STATIC_LIBRARIES += \ |
Logan Chien | bd48570 | 2011-07-18 09:16:28 +0800 | [diff] [blame] | 92 | libLLVMX86Disassembler |
Kenny Root | 34678ab | 2011-02-07 10:56:27 -0800 | [diff] [blame] | 93 | else |
| 94 | $(error Unsupported TARGET_ARCH $(TARGET_ARCH)) |
| 95 | endif |
| 96 | endif |
Shih-wei Liao | cd61af3 | 2010-04-29 00:02:57 -0700 | [diff] [blame] | 97 | endif |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 98 | |
Logan Chien | 41cb761 | 2011-07-12 16:12:03 +0800 | [diff] [blame] | 99 | ifeq ($(TARGET_ARCH),arm) |
| 100 | LOCAL_STATIC_LIBRARIES += \ |
| 101 | libLLVMARMCodeGen \ |
Shih-wei Liao | bb5df5c | 2011-07-19 05:15:11 -0700 | [diff] [blame] | 102 | libLLVMARMDesc \ |
Logan Chien | 41cb761 | 2011-07-12 16:12:03 +0800 | [diff] [blame] | 103 | libLLVMARMInfo |
| 104 | else |
| 105 | ifeq ($(TARGET_ARCH),x86) # We don't support x86-64 right now |
| 106 | LOCAL_STATIC_LIBRARIES += \ |
| 107 | libLLVMX86CodeGen \ |
Shih-wei Liao | bb5df5c | 2011-07-19 05:15:11 -0700 | [diff] [blame] | 108 | libLLVMX86Desc \ |
Logan Chien | 41cb761 | 2011-07-12 16:12:03 +0800 | [diff] [blame] | 109 | libLLVMX86Info \ |
Logan Chien | bd48570 | 2011-07-18 09:16:28 +0800 | [diff] [blame] | 110 | libLLVMX86Utils \ |
| 111 | libLLVMX86AsmPrinter |
Logan Chien | 41cb761 | 2011-07-12 16:12:03 +0800 | [diff] [blame] | 112 | else |
| 113 | $(error Unsupported TARGET_ARCH $(TARGET_ARCH)) |
| 114 | endif |
| 115 | endif |
| 116 | |
| 117 | LOCAL_STATIC_LIBRARIES += \ |
| 118 | libLLVMAsmPrinter \ |
| 119 | libLLVMBitReader \ |
| 120 | libLLVMSelectionDAG \ |
| 121 | libLLVMCodeGen \ |
| 122 | libLLVMLinker \ |
| 123 | libLLVMJIT \ |
| 124 | libLLVMScalarOpts \ |
| 125 | libLLVMInstCombine \ |
| 126 | libLLVMipo \ |
| 127 | libLLVMipa \ |
| 128 | libLLVMTransformUtils \ |
| 129 | libLLVMAnalysis \ |
| 130 | libLLVMTarget \ |
| 131 | libLLVMMCParser \ |
| 132 | libLLVMMC \ |
| 133 | libLLVMCore \ |
| 134 | libLLVMSupport |
| 135 | |
Stephen Hines | b67c9e7 | 2012-03-22 11:02:48 -0700 | [diff] [blame] | 136 | LOCAL_SHARED_LIBRARIES := libbcinfo libdl libcutils libutils libstlport |
Logan Chien | 41cb761 | 2011-07-12 16:12:03 +0800 | [diff] [blame] | 137 | |
Ying Wang | 26fea10 | 2011-07-05 15:12:25 -0700 | [diff] [blame] | 138 | # Modules that need get installed if and only if the target libbcc.so is installed. |
| 139 | LOCAL_REQUIRED_MODULES := libclcore.bc libbcc.so.sha1 |
Ying Wang | 3ae8c2a | 2011-01-14 10:50:53 -0800 | [diff] [blame] | 140 | |
Shih-wei Liao | 6fb71c5 | 2011-10-13 11:26:25 -0700 | [diff] [blame] | 141 | # -Wl,--exclude-libs=ALL only applies to library archives. It would hide most of |
Shih-wei Liao | 9d9d6bd | 2011-10-19 01:34:29 -0700 | [diff] [blame] | 142 | # the symbols in this shared library. As a result, it reduced the size of libbcc.so |
| 143 | # by about 800k in 2010. |
Shih-wei Liao | 6fb71c5 | 2011-10-13 11:26:25 -0700 | [diff] [blame] | 144 | # Note that libLLVMBitReader:libLLVMCore:libLLVMSupport are used by pixelflinger2. |
Shih-wei Liao | 9d9d6bd | 2011-10-19 01:34:29 -0700 | [diff] [blame] | 145 | LOCAL_LDFLAGS += -Wl,--exclude-libs=libLLVMARMDisassembler:libLLVMARMAsmPrinter:libLLVMX86Disassembler:libLLVMX86AsmPrinter:libLLVMMCParser:libLLVMARMCodeGen:libLLVMARMDesc:libLLVMARMInfo:libLLVMSelectionDAG:libLLVMAsmPrinter:libLLVMCodeGen:libLLVMLinker:libLLVMJIT:libLLVMTarget:libLLVMMC:libLLVMScalarOpts:libLLVMInstCombine:libLLVMipo:libLLVMipa:libLLVMTransformUtils:libLLVMAnalysis |
Shih-wei Liao | b8b7f2d | 2011-01-14 04:38:39 -0800 | [diff] [blame] | 146 | |
Logan Chien | 48dc01d | 2011-07-13 18:12:06 +0800 | [diff] [blame] | 147 | # Generate build stamp (Build time + Build git revision + Build Semi SHA1) |
| 148 | include $(LOCAL_PATH)/libbcc-gen-build-stamp.mk |
| 149 | |
Logan Chien | eb56784 | 2011-07-14 19:58:42 +0800 | [diff] [blame] | 150 | include $(LIBBCC_ROOT_PATH)/libbcc-gen-config-from-mk.mk |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 151 | include $(LLVM_ROOT_PATH)/llvm-device-build.mk |
| 152 | include $(BUILD_SHARED_LIBRARY) |
| 153 | |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 154 | |
| 155 | #===================================================================== |
| 156 | # Host Shared Library libbcc |
| 157 | #===================================================================== |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 158 | include $(CLEAR_VARS) |
| 159 | |
| 160 | LOCAL_MODULE := libbcc |
Zonr Chang | 932648d | 2010-10-13 22:23:56 +0800 | [diff] [blame] | 161 | LOCAL_MODULE_TAGS := optional |
Joseph Wen | 5de1adf | 2011-06-21 15:41:31 -0700 | [diff] [blame] | 162 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES |
| 163 | LOCAL_IS_HOST_MODULE := true |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 164 | |
Logan Chien | f68882e | 2011-07-18 19:11:39 +0800 | [diff] [blame] | 165 | LOCAL_CFLAGS := $(libbcc_CFLAGS) |
| 166 | LOCAL_C_INCLUDES := $(libbcc_C_INCLUDES) |
| 167 | |
| 168 | LOCAL_SRC_FILES := lib/ExecutionEngine/bcc.cpp |
| 169 | |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 170 | LOCAL_WHOLE_STATIC_LIBRARIES += $(libbcc_WHOLE_STATIC_LIBRARIES) |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 171 | |
Shih-wei Liao | ad39be4 | 2011-06-17 23:51:04 -0700 | [diff] [blame] | 172 | ifeq ($(libbcc_USE_MCJIT),1) |
Shih-wei Liao | be857c0 | 2011-06-19 11:51:17 -0700 | [diff] [blame] | 173 | LOCAL_STATIC_LIBRARIES += librsloader |
Shih-wei Liao | ad39be4 | 2011-06-17 23:51:04 -0700 | [diff] [blame] | 174 | endif |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 175 | |
Logan Chien | 41cb761 | 2011-07-12 16:12:03 +0800 | [diff] [blame] | 176 | ifeq ($(libbcc_USE_DISASSEMBLER),1) |
| 177 | LOCAL_STATIC_LIBRARIES += \ |
| 178 | libLLVMARMDisassembler \ |
| 179 | libLLVMARMAsmPrinter \ |
| 180 | libLLVMX86Disassembler \ |
| 181 | libLLVMMCParser |
| 182 | endif |
| 183 | |
Shih-wei Liao | a6ced2a | 2011-06-18 00:50:55 -0700 | [diff] [blame] | 184 | LOCAL_STATIC_LIBRARIES += \ |
Shih-wei Liao | a6ced2a | 2011-06-18 00:50:55 -0700 | [diff] [blame] | 185 | libcutils \ |
| 186 | libutils \ |
Logan Chien | 41cb761 | 2011-07-12 16:12:03 +0800 | [diff] [blame] | 187 | libLLVMARMCodeGen \ |
Shih-wei Liao | bb5df5c | 2011-07-19 05:15:11 -0700 | [diff] [blame] | 188 | libLLVMARMDesc \ |
Logan Chien | 41cb761 | 2011-07-12 16:12:03 +0800 | [diff] [blame] | 189 | libLLVMARMInfo \ |
Shih-wei Liao | a6ced2a | 2011-06-18 00:50:55 -0700 | [diff] [blame] | 190 | libLLVMX86CodeGen \ |
Shih-wei Liao | bb5df5c | 2011-07-19 05:15:11 -0700 | [diff] [blame] | 191 | libLLVMX86Desc \ |
Shih-wei Liao | a6ced2a | 2011-06-18 00:50:55 -0700 | [diff] [blame] | 192 | libLLVMX86Info \ |
| 193 | libLLVMX86Utils \ |
| 194 | libLLVMX86AsmPrinter \ |
Logan Chien | 41cb761 | 2011-07-12 16:12:03 +0800 | [diff] [blame] | 195 | libLLVMAsmPrinter \ |
Shih-wei Liao | a6ced2a | 2011-06-18 00:50:55 -0700 | [diff] [blame] | 196 | libLLVMBitReader \ |
| 197 | libLLVMSelectionDAG \ |
Shih-wei Liao | a6ced2a | 2011-06-18 00:50:55 -0700 | [diff] [blame] | 198 | libLLVMCodeGen \ |
| 199 | libLLVMLinker \ |
| 200 | libLLVMJIT \ |
Shih-wei Liao | a6ced2a | 2011-06-18 00:50:55 -0700 | [diff] [blame] | 201 | libLLVMScalarOpts \ |
| 202 | libLLVMInstCombine \ |
| 203 | libLLVMipo \ |
| 204 | libLLVMipa \ |
| 205 | libLLVMTransformUtils \ |
Shih-wei Liao | 34499f4 | 2011-06-20 22:40:45 -0700 | [diff] [blame] | 206 | libLLVMAnalysis \ |
Logan Chien | 41cb761 | 2011-07-12 16:12:03 +0800 | [diff] [blame] | 207 | libLLVMTarget \ |
| 208 | libLLVMMCParser \ |
| 209 | libLLVMMC \ |
| 210 | libLLVMCore \ |
Shih-wei Liao | a883314 | 2011-06-20 13:58:54 -0700 | [diff] [blame] | 211 | libLLVMSupport |
Shih-wei Liao | a6ced2a | 2011-06-18 00:50:55 -0700 | [diff] [blame] | 212 | |
Stephen Hines | b67c9e7 | 2012-03-22 11:02:48 -0700 | [diff] [blame] | 213 | LOCAL_SHARED_LIBRARIES := libbcinfo |
| 214 | |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 215 | LOCAL_LDLIBS := -ldl -lpthread |
| 216 | |
Logan Chien | 48dc01d | 2011-07-13 18:12:06 +0800 | [diff] [blame] | 217 | # Generate build stamp (Build time + Build git revision + Build Semi SHA1) |
| 218 | include $(LOCAL_PATH)/libbcc-gen-build-stamp.mk |
| 219 | |
Shih-wei Liao | e64c287 | 2010-10-25 13:44:53 -0700 | [diff] [blame] | 220 | # definitions for LLVM |
Stephen Hines | 40b7fba | 2011-03-17 19:50:20 -0700 | [diff] [blame] | 221 | LOCAL_CFLAGS += -DDEBUG_CODEGEN=1 |
Kenny Root | 34678ab | 2011-02-07 10:56:27 -0800 | [diff] [blame] | 222 | |
| 223 | ifeq ($(TARGET_ARCH),arm) |
| 224 | LOCAL_CFLAGS += -DFORCE_ARM_CODEGEN=1 |
| 225 | else |
| 226 | ifeq ($(TARGET_ARCH),x86) |
| 227 | LOCAL_CFLAGS += -DFORCE_X86_CODEGEN=1 |
| 228 | else |
| 229 | $(error Unsupported TARGET_ARCH $(TARGET_ARCH)) |
| 230 | endif |
| 231 | endif |
Shih-wei Liao | e64c287 | 2010-10-25 13:44:53 -0700 | [diff] [blame] | 232 | |
Logan Chien | eb56784 | 2011-07-14 19:58:42 +0800 | [diff] [blame] | 233 | include $(LIBBCC_ROOT_PATH)/libbcc-gen-config-from-mk.mk |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 234 | include $(LLVM_ROOT_PATH)/llvm-host-build.mk |
| 235 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 236 | |
Logan Chien | 7439685 | 2011-07-12 15:50:26 +0800 | [diff] [blame] | 237 | |
| 238 | #===================================================================== |
| 239 | # Include Subdirectories |
| 240 | #===================================================================== |
Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 241 | include $(call all-makefiles-under,$(LOCAL_PATH)) |