1 2.include <src.opts.mk> 3 4LLVM_BASE= ${SRCTOP}/contrib/llvm-project 5LLVM_SRCS= ${LLVM_BASE}/llvm 6LLD_SRCS= ${LLVM_BASE}/lld 7 8PACKAGE= lld 9PROG_CXX= ld.lld 10# Man page directory 11.PATH: ${LLD_SRCS}/docs 12.if (!defined(TOOLS_PREFIX) && ${MK_LLD_IS_LD} != "no") || \ 13 (defined(TOOLS_PREFIX) && ${MK_LLD_BOOTSTRAP} != "no") 14SYMLINKS= ${PROG_CXX} ${BINDIR}/ld 15MLINKS= ld.lld.1 ld.1 16.endif 17 18.include "${SRCTOP}/lib/clang/llvm.pre.mk" 19 20CFLAGS+= -I${LLD_SRCS}/ELF 21CFLAGS+= -I${LLD_SRCS}/include 22CFLAGS+= -I${.OBJDIR} 23CFLAGS+= -I${OBJTOP}/lib/clang/libllvm 24CFLAGS+= -I${SRCTOP}/sys/contrib/zstd/lib 25 26SRCDIR= lld 27SRCS+= Common/Args.cpp 28SRCS+= Common/CommonLinkerContext.cpp 29SRCS+= Common/DWARF.cpp 30SRCS+= Common/ErrorHandler.cpp 31SRCS+= Common/Filesystem.cpp 32SRCS+= Common/Memory.cpp 33SRCS+= Common/Reproduce.cpp 34SRCS+= Common/Strings.cpp 35SRCS+= Common/TargetOptionsCommandFlags.cpp 36SRCS+= Common/Version.cpp 37SRCS+= ELF/AArch64ErrataFix.cpp 38SRCS+= ELF/ARMErrataFix.cpp 39SRCS+= ELF/Arch/AArch64.cpp 40SRCS+= ELF/Arch/AMDGPU.cpp 41SRCS+= ELF/Arch/ARM.cpp 42SRCS+= ELF/Arch/AVR.cpp 43SRCS+= ELF/Arch/Hexagon.cpp 44SRCS+= ELF/Arch/MSP430.cpp 45SRCS+= ELF/Arch/Mips.cpp 46SRCS+= ELF/Arch/MipsArchTree.cpp 47SRCS+= ELF/Arch/PPC.cpp 48SRCS+= ELF/Arch/PPC64.cpp 49SRCS+= ELF/Arch/RISCV.cpp 50SRCS+= ELF/Arch/SPARCV9.cpp 51SRCS+= ELF/Arch/X86.cpp 52SRCS+= ELF/Arch/X86_64.cpp 53SRCS+= ELF/CallGraphSort.cpp 54SRCS+= ELF/DWARF.cpp 55SRCS+= ELF/Driver.cpp 56SRCS+= ELF/DriverUtils.cpp 57SRCS+= ELF/EhFrame.cpp 58SRCS+= ELF/ICF.cpp 59SRCS+= ELF/InputFiles.cpp 60SRCS+= ELF/InputSection.cpp 61SRCS+= ELF/LTO.cpp 62SRCS+= ELF/LinkerScript.cpp 63SRCS+= ELF/MapFile.cpp 64SRCS+= ELF/MarkLive.cpp 65SRCS+= ELF/OutputSections.cpp 66SRCS+= ELF/Relocations.cpp 67SRCS+= ELF/ScriptLexer.cpp 68SRCS+= ELF/ScriptParser.cpp 69SRCS+= ELF/SymbolTable.cpp 70SRCS+= ELF/Symbols.cpp 71SRCS+= ELF/SyntheticSections.cpp 72SRCS+= ELF/Target.cpp 73SRCS+= ELF/Thunks.cpp 74SRCS+= ELF/Writer.cpp 75SRCS+= tools/lld/lld.cpp 76 77CFLAGS.lld.cpp+= -Dlld_main=main 78 79.include "${SRCTOP}/lib/clang/llvm.build.mk" 80 81LIBDEPS+= llvm 82 83.for lib in ${LIBDEPS} 84DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a 85LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a 86.endfor 87 88INCFILE= Options.inc 89TDFILE= ${LLD_SRCS}/ELF/Options.td 90GENOPT= -gen-opt-parser-defs 91${INCFILE}: ${TDFILE} 92 ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ 93 -o ${.TARGET} ${TDFILE} 94TGHDRS+= ${INCFILE} 95 96DEPENDFILES+= ${TGHDRS:C/$/.d/} 97DPSRCS+= ${TGHDRS} 98CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} 99 100.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) 101LIBADD+= execinfo 102LIBADD+= tinfow 103.endif 104LIBADD+= pthread 105LIBADD+= z 106LIBADD+= zstd 107 108.include <bsd.prog.mk> 109