1LOCAL_PATH:= $(call my-dir) 2 3LOCAL_MODULE_TAGS := optional 4 5# Set up common build variables 6# ===================================================== 7 8MCLD_C_INCLUDES := $(LOCAL_PATH)/include 9 10MCLD_SRC_FILES := \ 11 Main.cpp 12 13 14MCLD_WHOLE_STATIC_LIBRARIES := \ 15 libmcldADT \ 16 libmcldCore \ 17 libmcldFragment \ 18 libmcldLD \ 19 libmcldLDVariant \ 20 libmcldMC \ 21 libmcldObject \ 22 libmcldScript \ 23 libmcldSupport \ 24 libmcldTarget 25 26MCLD_SHARED_LIBRARIES := libLLVM 27 28# Collect target specific code generation libraries 29MCLD_ARM_LIBS := libmcldARMTarget libmcldARMInfo 30MCLD_AARCH64_LIBS := libmcldAArch64Target libmcldAArch64Info 31MCLD_MIPS_LIBS := libmcldMipsTarget libmcldMipsInfo 32MCLD_X86_LIBS := libmcldX86Target libmcldX86Info 33 34MCLD_MODULE:= ld.mc 35 36# Executable for the device 37# ===================================================== 38include $(CLEAR_VARS) 39include $(CLEAR_TBLGEN_VARS) 40 41LOCAL_C_INCLUDES := $(MCLD_C_INCLUDES) 42LOCAL_SRC_FILES := $(MCLD_SRC_FILES) 43LOCAL_WHOLE_STATIC_LIBRARIES := $(MCLD_WHOLE_STATIC_LIBRARIES) 44 45# Add target specific code generation libraries 46ifeq ($(TARGET_ARCH), arm) 47 LOCAL_WHOLE_STATIC_LIBRARIES += $(MCLD_ARM_LIBS) 48endif 49 50# Include ARM libs to enable 32-bit linking on AARCH64 targets 51ifeq ($(TARGET_ARCH), arm64) 52 LOCAL_WHOLE_STATIC_LIBRARIES += $(MCLD_AARCH64_LIBS) \ 53 $(MCLD_ARM_LIBS) 54endif 55 56ifneq (, $(findstring mips,$(TARGET_ARCH))) 57 LOCAL_WHOLE_STATIC_LIBRARIES += $(MCLD_MIPS_LIBS) 58endif 59 60# Add x86 libraries for both x86 and x86_64 targets 61ifneq (, $(findstring x86,$(TARGET_ARCH))) 62 LOCAL_WHOLE_STATIC_LIBRARIES += $(MCLD_X86_LIBS) 63ifeq ($(BUILD_ARM_FOR_X86),true) 64 LOCAL_WHOLE_STATIC_LIBRARIES += $(MCLD_ARM_LIBS) \ 65 $(MCLD_AARCH64_LIBS) 66endif 67endif 68 69 70# zlib's libnames are different for the host and target. 71# For the target, it is the standard libz 72LOCAL_SHARED_LIBRARIES := $(MCLD_SHARED_LIBRARIES) libz 73 74LOCAL_MODULE := $(MCLD_MODULE) 75LOCAL_MODULE_CLASS := EXECUTABLES 76 77# Build Options.inc from Options.td for the device 78intermediates := $(call local-generated-sources-dir) 79LOCAL_GENERATED_SOURCES += $(intermediates)/Options.inc 80$(intermediates)/Options.inc: $(LOCAL_PATH)/Options.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(LLVM_TBLGEN) 81 $(call transform-device-td-to-out,opt-parser-defs) 82 83include $(MCLD_DEVICE_BUILD_MK) 84include $(BUILD_EXECUTABLE) 85 86# Executable for the host 87# ===================================================== 88include $(CLEAR_VARS) 89include $(CLEAR_TBLGEN_VARS) 90 91LOCAL_C_INCLUDES := $(MCLD_C_INCLUDES) 92LOCAL_SRC_FILES := $(MCLD_SRC_FILES) 93 94LOCAL_WHOLE_STATIC_LIBRARIES := $(MCLD_WHOLE_STATIC_LIBRARIES) 95LOCAL_WHOLE_STATIC_LIBRARIES += $(MCLD_ARM_LIBS) \ 96 $(MCLD_AARCH64_LIBS) \ 97 $(MCLD_MIPS_LIBS) \ 98 $(MCLD_X86_LIBS) 99 100# zlib's libnames are different for the host and target. 101# For the host, it is libz-host 102LOCAL_SHARED_LIBRARIES := $(MCLD_SHARED_LIBRARIES) libz-host 103 104LOCAL_MODULE := $(MCLD_MODULE) 105LOCAL_MODULE_CLASS := EXECUTABLES 106LOCAL_IS_HOST_MODULE := true 107 108# Build Options.inc from Options.td for the host 109intermediates := $(call local-generated-sources-dir) 110LOCAL_GENERATED_SOURCES += $(intermediates)/Options.inc 111$(intermediates)/Options.inc: $(LOCAL_PATH)/Options.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(LLVM_TBLGEN) 112 $(call transform-host-td-to-out,opt-parser-defs) 113 114include $(MCLD_HOST_BUILD_MK) 115include $(BUILD_HOST_EXECUTABLE) 116