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 17 LOCAL_PATH := $(call my-dir) 18 include $(LOCAL_PATH)/libbcc-config.mk 19 20 21 #===================================================================== 22 # Whole Static Library to Be Linked In 23 #===================================================================== 24 25 ifeq ($(libbcc_USE_OLD_JIT),1) 26 libbcc_WHOLE_STATIC_LIBRARIES += libbccCodeGen 27 endif 28 29 ifeq ($(libbcc_USE_DISASSEMBLER),1) 30 libbcc_WHOLE_STATIC_LIBRARIES += libbccDisassembler 31 endif 32 33 libbcc_WHOLE_STATIC_LIBRARIES += \ 34 libbccExecutionEngine \ 35 libbccHelper 36 37 38 #===================================================================== 39 # Calculate SHA1 checksum for libbcc.so and libRS.so 40 #===================================================================== 41 42 include $(CLEAR_VARS) 43 44 LOCAL_MODULE := libbcc.so.sha1 45 LOCAL_MODULE_TAGS := optional 46 LOCAL_MODULE_CLASS := SHARED_LIBRARIES 47 48 include $(BUILD_SYSTEM)/base_rules.mk 49 libbcc_SHA1_SRCS := \ 50 $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libbcc.so \ 51 $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRS.so 52 53 libbcc_GEN_SHA1_STAMP := $(LOCAL_PATH)/tools/gen-sha1-stamp.py 54 55 $(LOCAL_BUILT_MODULE): PRIVATE_SHA1_SRCS := $(libbcc_SHA1_SRCS) 56 $(LOCAL_BUILT_MODULE): $(libbcc_SHA1_SRCS) $(libbcc_GEN_SHA1_STAMP) 57 $(hide) mkdir -p $(dir $@) && \ 58 $(libbcc_GEN_SHA1_STAMP) $@ $(PRIVATE_SHA1_SRCS) 59 60 61 #===================================================================== 62 # Device Shared Library libbcc 63 #===================================================================== 64 65 include $(CLEAR_VARS) 66 67 LOCAL_MODULE := libbcc 68 LOCAL_MODULE_TAGS := optional 69 LOCAL_MODULE_CLASS := SHARED_LIBRARIES 70 71 LOCAL_CFLAGS := $(libbcc_CFLAGS) 72 LOCAL_C_INCLUDES := $(libbcc_C_INCLUDES) 73 74 LOCAL_SRC_FILES := lib/ExecutionEngine/bcc.cpp 75 76 LOCAL_WHOLE_STATIC_LIBRARIES += \ 77 $(libbcc_WHOLE_STATIC_LIBRARIES) \ 78 libbccCompilerRT 79 80 ifeq ($(libbcc_USE_MCJIT),1) 81 LOCAL_STATIC_LIBRARIES += librsloader 82 endif 83 84 ifeq ($(libbcc_USE_DISASSEMBLER),1) 85 ifeq ($(TARGET_ARCH),arm) 86 LOCAL_STATIC_LIBRARIES += \ 87 libLLVMARMDisassembler \ 88 libLLVMARMAsmPrinter 89 else 90 ifeq ($(TARGET_ARCH),x86) 91 LOCAL_STATIC_LIBRARIES += \ 92 libLLVMX86Disassembler 93 else 94 $(error Unsupported TARGET_ARCH $(TARGET_ARCH)) 95 endif 96 endif 97 endif 98 99 ifeq ($(TARGET_ARCH),arm) 100 LOCAL_STATIC_LIBRARIES += \ 101 libLLVMARMCodeGen \ 102 libLLVMARMDesc \ 103 libLLVMARMInfo 104 else 105 ifeq ($(TARGET_ARCH),x86) # We don't support x86-64 right now 106 LOCAL_STATIC_LIBRARIES += \ 107 libLLVMX86CodeGen \ 108 libLLVMX86Desc \ 109 libLLVMX86Info \ 110 libLLVMX86Utils \ 111 libLLVMX86AsmPrinter 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 136 LOCAL_SHARED_LIBRARIES := libdl libcutils libutils libstlport 137 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 140 141 # -Wl,--exclude-libs=ALL only applies to library archives. It would hide most of 142 # the symbols in this shared library. 143 # It reduces the size of libbcc.so by about 800k. 144 # Note that libLLVMBitReader:libLLVMCore:libLLVMSupport are used by pixelflinger2. 145 LOCAL_LDFLAGS += -Wl,--exclude-libs=ALL 146 #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 :libLLVMBitReader:libLLVMCore:libLLVMSupport:librsloader 147 148 # Generate build stamp (Build time + Build git revision + Build Semi SHA1) 149 include $(LOCAL_PATH)/libbcc-gen-build-stamp.mk 150 151 include $(LIBBCC_ROOT_PATH)/libbcc-gen-config-from-mk.mk 152 include $(LLVM_ROOT_PATH)/llvm-device-build.mk 153 include $(BUILD_SHARED_LIBRARY) 154 155 156 #===================================================================== 157 # Host Shared Library libbcc 158 #===================================================================== 159 include $(CLEAR_VARS) 160 161 LOCAL_MODULE := libbcc 162 LOCAL_MODULE_TAGS := optional 163 LOCAL_MODULE_CLASS := SHARED_LIBRARIES 164 LOCAL_IS_HOST_MODULE := true 165 166 LOCAL_CFLAGS := $(libbcc_CFLAGS) 167 LOCAL_C_INCLUDES := $(libbcc_C_INCLUDES) 168 169 LOCAL_SRC_FILES := lib/ExecutionEngine/bcc.cpp 170 171 LOCAL_WHOLE_STATIC_LIBRARIES += $(libbcc_WHOLE_STATIC_LIBRARIES) 172 173 ifeq ($(libbcc_USE_MCJIT),1) 174 LOCAL_STATIC_LIBRARIES += librsloader 175 endif 176 177 ifeq ($(libbcc_USE_DISASSEMBLER),1) 178 LOCAL_STATIC_LIBRARIES += \ 179 libLLVMARMDisassembler \ 180 libLLVMARMAsmPrinter \ 181 libLLVMX86Disassembler \ 182 libLLVMMCParser 183 endif 184 185 LOCAL_STATIC_LIBRARIES += \ 186 libcutils \ 187 libutils \ 188 libLLVMARMCodeGen \ 189 libLLVMARMDesc \ 190 libLLVMARMInfo \ 191 libLLVMX86CodeGen \ 192 libLLVMX86Desc \ 193 libLLVMX86Info \ 194 libLLVMX86Utils \ 195 libLLVMX86AsmPrinter \ 196 libLLVMAsmPrinter \ 197 libLLVMBitReader \ 198 libLLVMSelectionDAG \ 199 libLLVMCodeGen \ 200 libLLVMLinker \ 201 libLLVMJIT \ 202 libLLVMScalarOpts \ 203 libLLVMInstCombine \ 204 libLLVMipo \ 205 libLLVMipa \ 206 libLLVMTransformUtils \ 207 libLLVMAnalysis \ 208 libLLVMTarget \ 209 libLLVMMCParser \ 210 libLLVMMC \ 211 libLLVMCore \ 212 libLLVMSupport 213 214 LOCAL_LDLIBS := -ldl -lpthread 215 216 # Generate build stamp (Build time + Build git revision + Build Semi SHA1) 217 include $(LOCAL_PATH)/libbcc-gen-build-stamp.mk 218 219 # definitions for LLVM 220 LOCAL_CFLAGS += -DDEBUG_CODEGEN=1 221 222 ifeq ($(TARGET_ARCH),arm) 223 LOCAL_CFLAGS += -DFORCE_ARM_CODEGEN=1 224 else 225 ifeq ($(TARGET_ARCH),x86) 226 LOCAL_CFLAGS += -DFORCE_X86_CODEGEN=1 227 else 228 $(error Unsupported TARGET_ARCH $(TARGET_ARCH)) 229 endif 230 endif 231 232 include $(LIBBCC_ROOT_PATH)/libbcc-gen-config-from-mk.mk 233 include $(LLVM_ROOT_PATH)/llvm-host-build.mk 234 include $(BUILD_HOST_SHARED_LIBRARY) 235 236 237 #===================================================================== 238 # Include Subdirectories 239 #===================================================================== 240 include $(call all-makefiles-under,$(LOCAL_PATH)) 241