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