1# 2# Copyright (C) 2010-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 17LOCAL_PATH := $(call my-dir) 18include $(LOCAL_PATH)/libbcc-config.mk 19 20 21#===================================================================== 22# Whole Static Library to Be Linked In 23#===================================================================== 24 25ifeq ($(libbcc_USE_DISASSEMBLER),1) 26libbcc_WHOLE_STATIC_LIBRARIES += libbccDisassembler 27endif 28 29libbcc_WHOLE_STATIC_LIBRARIES += \ 30 libbccExecutionEngine \ 31 libbccHelper \ 32 libbccTransforms 33 34 35#===================================================================== 36# Calculate SHA1 checksum for libbcc.so and libRS.so 37#===================================================================== 38 39include $(CLEAR_VARS) 40 41LOCAL_MODULE := libbcc.so.sha1 42LOCAL_MODULE_TAGS := optional 43LOCAL_MODULE_CLASS := SHARED_LIBRARIES 44 45include $(BUILD_SYSTEM)/base_rules.mk 46libbcc_SHA1_SRCS := \ 47 $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libbcc.so \ 48 $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRS.so 49 50libbcc_GEN_SHA1_STAMP := $(LOCAL_PATH)/tools/build/gen-sha1-stamp.py 51 52$(LOCAL_BUILT_MODULE): PRIVATE_SHA1_SRCS := $(libbcc_SHA1_SRCS) 53$(LOCAL_BUILT_MODULE): $(libbcc_SHA1_SRCS) $(libbcc_GEN_SHA1_STAMP) 54 $(hide) mkdir -p $(dir $@) && \ 55 $(libbcc_GEN_SHA1_STAMP) $@ $(PRIVATE_SHA1_SRCS) 56 57 58#===================================================================== 59# Device Shared Library libbcc 60#===================================================================== 61 62include $(CLEAR_VARS) 63 64LOCAL_MODULE := libbcc 65LOCAL_MODULE_TAGS := optional 66LOCAL_MODULE_CLASS := SHARED_LIBRARIES 67 68LOCAL_CFLAGS := $(libbcc_CFLAGS) 69LOCAL_C_INCLUDES := $(libbcc_C_INCLUDES) 70 71LOCAL_SRC_FILES := lib/ExecutionEngine/bcc.cpp 72 73LOCAL_WHOLE_STATIC_LIBRARIES := $(libbcc_WHOLE_STATIC_LIBRARIES) 74 75ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm x86)) 76LOCAL_WHOLE_STATIC_LIBRARIES += libbccCompilerRT 77endif 78 79LOCAL_STATIC_LIBRARIES += librsloader 80 81ifeq ($(libbcc_USE_DISASSEMBLER),1) 82 ifeq ($(TARGET_ARCH),arm) 83 LOCAL_STATIC_LIBRARIES += \ 84 libLLVMARMDisassembler \ 85 libLLVMARMAsmPrinter 86 else 87 ifeq ($(TARGET_ARCH),mips) 88 $(error "Disassembler is not available for MIPS architecture") 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 98endif 99 100ifeq ($(TARGET_ARCH),arm) 101 LOCAL_STATIC_LIBRARIES += \ 102 libLLVMARMCodeGen \ 103 libLLVMARMDesc \ 104 libLLVMARMInfo 105else 106 ifeq ($(TARGET_ARCH), mips) 107 LOCAL_STATIC_LIBRARIES += \ 108 libLLVMMipsCodeGen \ 109 libLLVMMipsAsmPrinter \ 110 libLLVMMipsDesc \ 111 libLLVMMipsInfo 112 else 113 ifeq ($(TARGET_ARCH),x86) # We don't support x86-64 right now 114 LOCAL_STATIC_LIBRARIES += \ 115 libLLVMX86CodeGen \ 116 libLLVMX86Desc \ 117 libLLVMX86Info \ 118 libLLVMX86Utils \ 119 libLLVMX86AsmPrinter 120 else 121 $(error Unsupported TARGET_ARCH $(TARGET_ARCH)) 122 endif 123 endif 124endif 125 126LOCAL_STATIC_LIBRARIES += \ 127 libLLVMAsmPrinter \ 128 libLLVMBitReader \ 129 libLLVMSelectionDAG \ 130 libLLVMCodeGen \ 131 libLLVMLinker \ 132 libLLVMScalarOpts \ 133 libLLVMInstCombine \ 134 libLLVMipo \ 135 libLLVMipa \ 136 libLLVMTransformUtils \ 137 libLLVMAnalysis \ 138 libLLVMTarget \ 139 libLLVMMCParser \ 140 libLLVMMC \ 141 libLLVMCore \ 142 libLLVMSupport 143 144LOCAL_SHARED_LIBRARIES := libbcinfo libdl libutils libcutils libstlport 145 146# Modules that need get installed if and only if the target libbcc.so is 147# installed. 148LOCAL_REQUIRED_MODULES := libclcore.bc libbcc.so.sha1 149 150ifeq ($(ARCH_ARM_HAVE_NEON),true) 151LOCAL_REQUIRED_MODULES += libclcore_neon.bc 152endif 153 154# Link-Time Optimization on libbcc.so 155# 156# -Wl,--exclude-libs=ALL only applies to library archives. It would hide most 157# of the symbols in this shared library. As a result, it reduced the size of 158# libbcc.so by about 800k in 2010. 159# 160# Note that libLLVMBitReader:libLLVMCore:libLLVMSupport are used by 161# pixelflinger2. 162 163LOCAL_LDFLAGS += -Wl,--exclude-libs=libLLVMARMDisassembler:libLLVMARMAsmPrinter:libLLVMX86Disassembler:libLLVMX86AsmPrinter:libLLVMMCParser:libLLVMARMCodeGen:libLLVMARMDesc:libLLVMARMInfo:libLLVMSelectionDAG:libLLVMAsmPrinter:libLLVMCodeGen:libLLVMLinker:libLLVMTarget:libLLVMMC:libLLVMScalarOpts:libLLVMInstCombine:libLLVMipo:libLLVMipa:libLLVMTransformUtils:libLLVMAnalysis 164 165# Generate build stamp (Build time + Build git revision + Build Semi SHA1) 166include $(LOCAL_PATH)/libbcc-gen-build-stamp.mk 167 168include $(LIBBCC_ROOT_PATH)/libbcc-gen-config-from-mk.mk 169include $(LLVM_ROOT_PATH)/llvm-device-build.mk 170include $(BUILD_SHARED_LIBRARY) 171 172 173#===================================================================== 174# Host Shared Library libbcc 175#===================================================================== 176 177include $(CLEAR_VARS) 178 179LOCAL_MODULE := libbcc 180LOCAL_MODULE_TAGS := optional 181LOCAL_MODULE_CLASS := SHARED_LIBRARIES 182LOCAL_IS_HOST_MODULE := true 183 184LOCAL_CFLAGS := $(libbcc_CFLAGS) 185LOCAL_CFLAGS += -D__HOST__ 186LOCAL_C_INCLUDES := $(libbcc_C_INCLUDES) 187 188LOCAL_SRC_FILES := lib/ExecutionEngine/bcc.cpp 189 190LOCAL_WHOLE_STATIC_LIBRARIES += $(libbcc_WHOLE_STATIC_LIBRARIES) 191 192LOCAL_STATIC_LIBRARIES += librsloader 193 194ifeq ($(libbcc_USE_DISASSEMBLER),1) 195 LOCAL_STATIC_LIBRARIES += \ 196 libLLVMARMDisassembler \ 197 libLLVMARMAsmPrinter \ 198 libLLVMX86Disassembler \ 199 libLLVMMCParser 200endif 201 202LOCAL_STATIC_LIBRARIES += \ 203 libLLVMARMCodeGen \ 204 libLLVMARMDesc \ 205 libLLVMARMInfo 206 207LOCAL_STATIC_LIBRARIES += \ 208 libLLVMMipsCodeGen \ 209 libLLVMMipsAsmPrinter \ 210 libLLVMMipsDesc \ 211 libLLVMMipsInfo 212 213LOCAL_STATIC_LIBRARIES += \ 214 libLLVMX86CodeGen \ 215 libLLVMX86Desc \ 216 libLLVMX86AsmPrinter \ 217 libLLVMX86Info \ 218 libLLVMX86Utils 219 220LOCAL_STATIC_LIBRARIES += \ 221 libLLVMAsmPrinter \ 222 libLLVMBitReader \ 223 libLLVMSelectionDAG \ 224 libLLVMCodeGen \ 225 libLLVMLinker \ 226 libLLVMScalarOpts \ 227 libLLVMInstCombine \ 228 libLLVMipo \ 229 libLLVMipa \ 230 libLLVMTransformUtils \ 231 libLLVMAnalysis \ 232 libLLVMTarget \ 233 libLLVMMCParser \ 234 libLLVMMC \ 235 libLLVMCore \ 236 libLLVMSupport 237 238LOCAL_STATIC_LIBRARIES += \ 239 libutils \ 240 libcutils 241 242LOCAL_SHARED_LIBRARIES := libbcinfo 243 244LOCAL_LDLIBS := -ldl -lpthread 245 246# Generate build stamp (Build time + Build git revision + Build Semi SHA1) 247include $(LOCAL_PATH)/libbcc-gen-build-stamp.mk 248 249include $(LIBBCC_ROOT_PATH)/libbcc-gen-config-from-mk.mk 250include $(LLVM_ROOT_PATH)/llvm-host-build.mk 251include $(BUILD_HOST_SHARED_LIBRARY) 252 253 254#===================================================================== 255# Include Subdirectories 256#===================================================================== 257include $(call all-makefiles-under,$(LOCAL_PATH)) 258