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