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 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_OLD_JIT),1) 26libbcc_WHOLE_STATIC_LIBRARIES += libbccCodeGen 27endif 28 29ifeq ($(libbcc_USE_DISASSEMBLER),1) 30libbcc_WHOLE_STATIC_LIBRARIES += libbccDisassembler 31endif 32 33libbcc_WHOLE_STATIC_LIBRARIES += \ 34 libbccExecutionEngine \ 35 libbccHelper 36 37 38#===================================================================== 39# Calculate SHA1 checksum for libbcc.so and libRS.so 40#===================================================================== 41 42include $(CLEAR_VARS) 43 44LOCAL_MODULE := libbcc.so.sha1 45LOCAL_MODULE_TAGS := optional 46LOCAL_MODULE_CLASS := SHARED_LIBRARIES 47 48include $(BUILD_SYSTEM)/base_rules.mk 49libbcc_SHA1_SRCS := \ 50 $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libbcc.so \ 51 $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRS.so 52 53libbcc_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 65include $(CLEAR_VARS) 66 67LOCAL_MODULE := libbcc 68LOCAL_MODULE_TAGS := optional 69LOCAL_MODULE_CLASS := SHARED_LIBRARIES 70 71LOCAL_CFLAGS := $(libbcc_CFLAGS) 72LOCAL_C_INCLUDES := $(libbcc_C_INCLUDES) 73 74LOCAL_SRC_FILES := lib/ExecutionEngine/bcc.cpp 75 76LOCAL_WHOLE_STATIC_LIBRARIES += \ 77 $(libbcc_WHOLE_STATIC_LIBRARIES) \ 78 libbccCompilerRT 79 80ifeq ($(libbcc_USE_MCJIT),1) 81 LOCAL_STATIC_LIBRARIES += librsloader 82endif 83 84ifeq ($(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 97endif 98 99ifeq ($(TARGET_ARCH),arm) 100 LOCAL_STATIC_LIBRARIES += \ 101 libLLVMARMCodeGen \ 102 libLLVMARMDesc \ 103 libLLVMARMInfo 104else 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 115endif 116 117LOCAL_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 136LOCAL_SHARED_LIBRARIES := libdl libcutils libutils libstlport 137 138# Modules that need get installed if and only if the target libbcc.so is installed. 139LOCAL_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. 145LOCAL_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) 149include $(LOCAL_PATH)/libbcc-gen-build-stamp.mk 150 151include $(LIBBCC_ROOT_PATH)/libbcc-gen-config-from-mk.mk 152include $(LLVM_ROOT_PATH)/llvm-device-build.mk 153include $(BUILD_SHARED_LIBRARY) 154 155 156#===================================================================== 157# Host Shared Library libbcc 158#===================================================================== 159include $(CLEAR_VARS) 160 161LOCAL_MODULE := libbcc 162LOCAL_MODULE_TAGS := optional 163LOCAL_MODULE_CLASS := SHARED_LIBRARIES 164LOCAL_IS_HOST_MODULE := true 165 166LOCAL_CFLAGS := $(libbcc_CFLAGS) 167LOCAL_C_INCLUDES := $(libbcc_C_INCLUDES) 168 169LOCAL_SRC_FILES := lib/ExecutionEngine/bcc.cpp 170 171LOCAL_WHOLE_STATIC_LIBRARIES += $(libbcc_WHOLE_STATIC_LIBRARIES) 172 173ifeq ($(libbcc_USE_MCJIT),1) 174 LOCAL_STATIC_LIBRARIES += librsloader 175endif 176 177ifeq ($(libbcc_USE_DISASSEMBLER),1) 178 LOCAL_STATIC_LIBRARIES += \ 179 libLLVMARMDisassembler \ 180 libLLVMARMAsmPrinter \ 181 libLLVMX86Disassembler \ 182 libLLVMMCParser 183endif 184 185LOCAL_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 214LOCAL_LDLIBS := -ldl -lpthread 215 216# Generate build stamp (Build time + Build git revision + Build Semi SHA1) 217include $(LOCAL_PATH)/libbcc-gen-build-stamp.mk 218 219# definitions for LLVM 220LOCAL_CFLAGS += -DDEBUG_CODEGEN=1 221 222ifeq ($(TARGET_ARCH),arm) 223 LOCAL_CFLAGS += -DFORCE_ARM_CODEGEN=1 224else 225 ifeq ($(TARGET_ARCH),x86) 226 LOCAL_CFLAGS += -DFORCE_X86_CODEGEN=1 227 else 228 $(error Unsupported TARGET_ARCH $(TARGET_ARCH)) 229 endif 230endif 231 232include $(LIBBCC_ROOT_PATH)/libbcc-gen-config-from-mk.mk 233include $(LLVM_ROOT_PATH)/llvm-host-build.mk 234include $(BUILD_HOST_SHARED_LIBRARY) 235 236 237#===================================================================== 238# Include Subdirectories 239#===================================================================== 240include $(call all-makefiles-under,$(LOCAL_PATH)) 241