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