xref: /freebsd/usr.bin/clang/lld/Makefile (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
10aa5466eSEd Maste.include <src.opts.mk>
20aa5466eSEd Maste
30b57cec5SDimitry AndricLLVM_BASE=	${SRCTOP}/contrib/llvm-project
40b57cec5SDimitry AndricLLVM_SRCS=	${LLVM_BASE}/llvm
50b57cec5SDimitry AndricLLD_SRCS=	${LLVM_BASE}/lld
6adbee188SEd Maste
78930262bSDimitry AndricPACKAGE=	lld
8adbee188SEd MastePROG_CXX=	ld.lld
9899fb13bSEd Maste# Man page directory
10899fb13bSEd Maste.PATH:		${LLD_SRCS}/docs
11ec4c2adbSBrooks Davis.if !defined(TOOLS_PREFIX) || \
12d74021d6SBryan Drewery    (defined(TOOLS_PREFIX) && ${MK_LLD_BOOTSTRAP} != "no")
130aa5466eSEd MasteSYMLINKS=	${PROG_CXX} ${BINDIR}/ld
1471e8c9b6SEd MasteMLINKS=		ld.lld.1 ld.1
150aa5466eSEd Maste.endif
16adbee188SEd Maste
17fe6060f1SDimitry Andric.include "${SRCTOP}/lib/clang/llvm.pre.mk"
18fe6060f1SDimitry Andric
1924d58133SDimitry AndricCFLAGS+=	-I${LLD_SRCS}/ELF
20adbee188SEd MasteCFLAGS+=	-I${LLD_SRCS}/include
21adbee188SEd MasteCFLAGS+=	-I${.OBJDIR}
22d5e94982SDimitry AndricCFLAGS+=	-I${OBJTOP}/lib/clang/libllvm
23bdd1243dSDimitry AndricCFLAGS+=	-I${SRCTOP}/sys/contrib/zstd/lib
24adbee188SEd Maste
250b57cec5SDimitry AndricSRCDIR=		lld
267bfc2d0fSDimitry AndricSRCS+=		Common/Args.cpp
2704eeddc0SDimitry AndricSRCS+=		Common/CommonLinkerContext.cpp
2856e766afSDimitry AndricSRCS+=		Common/DWARF.cpp
2906c3fb27SDimitry AndricSRCS+=		Common/DriverDispatcher.cpp
307bfc2d0fSDimitry AndricSRCS+=		Common/ErrorHandler.cpp
31390be9fcSDimitry AndricSRCS+=		Common/Filesystem.cpp
327bfc2d0fSDimitry AndricSRCS+=		Common/Memory.cpp
337bfc2d0fSDimitry AndricSRCS+=		Common/Reproduce.cpp
347bfc2d0fSDimitry AndricSRCS+=		Common/Strings.cpp
357bfc2d0fSDimitry AndricSRCS+=		Common/TargetOptionsCommandFlags.cpp
367bfc2d0fSDimitry AndricSRCS+=		Common/Version.cpp
377bfc2d0fSDimitry AndricSRCS+=		ELF/AArch64ErrataFix.cpp
3856e766afSDimitry AndricSRCS+=		ELF/ARMErrataFix.cpp
3924d58133SDimitry AndricSRCS+=		ELF/Arch/AArch64.cpp
4024d58133SDimitry AndricSRCS+=		ELF/Arch/AMDGPU.cpp
4124d58133SDimitry AndricSRCS+=		ELF/Arch/ARM.cpp
4224d58133SDimitry AndricSRCS+=		ELF/Arch/AVR.cpp
4329a348feSDimitry AndricSRCS+=		ELF/Arch/Hexagon.cpp
4406c3fb27SDimitry AndricSRCS+=		ELF/Arch/LoongArch.cpp
4506b606cfSDimitry AndricSRCS+=		ELF/Arch/MSP430.cpp
4624d58133SDimitry AndricSRCS+=		ELF/Arch/Mips.cpp
47edd7eaddSDimitry AndricSRCS+=		ELF/Arch/MipsArchTree.cpp
4824d58133SDimitry AndricSRCS+=		ELF/Arch/PPC.cpp
4924d58133SDimitry AndricSRCS+=		ELF/Arch/PPC64.cpp
5006b606cfSDimitry AndricSRCS+=		ELF/Arch/RISCV.cpp
51a580b014SDimitry AndricSRCS+=		ELF/Arch/SPARCV9.cpp
52*74626c16SDimitry AndricSRCS+=		ELF/Arch/SystemZ.cpp
5324d58133SDimitry AndricSRCS+=		ELF/Arch/X86.cpp
5424d58133SDimitry AndricSRCS+=		ELF/Arch/X86_64.cpp
5529a348feSDimitry AndricSRCS+=		ELF/CallGraphSort.cpp
5606b606cfSDimitry AndricSRCS+=		ELF/DWARF.cpp
57adbee188SEd MasteSRCS+=		ELF/Driver.cpp
58adbee188SEd MasteSRCS+=		ELF/DriverUtils.cpp
59adbee188SEd MasteSRCS+=		ELF/EhFrame.cpp
60adbee188SEd MasteSRCS+=		ELF/ICF.cpp
61adbee188SEd MasteSRCS+=		ELF/InputFiles.cpp
62adbee188SEd MasteSRCS+=		ELF/InputSection.cpp
63adbee188SEd MasteSRCS+=		ELF/LTO.cpp
64f8bb7d0fSDimitry AndricSRCS+=		ELF/LinkerScript.cpp
65f8bb7d0fSDimitry AndricSRCS+=		ELF/MapFile.cpp
66adbee188SEd MasteSRCS+=		ELF/MarkLive.cpp
67adbee188SEd MasteSRCS+=		ELF/OutputSections.cpp
68adbee188SEd MasteSRCS+=		ELF/Relocations.cpp
69f8bb7d0fSDimitry AndricSRCS+=		ELF/ScriptLexer.cpp
70adbee188SEd MasteSRCS+=		ELF/ScriptParser.cpp
71adbee188SEd MasteSRCS+=		ELF/SymbolTable.cpp
72adbee188SEd MasteSRCS+=		ELF/Symbols.cpp
731419873dSDimitry AndricSRCS+=		ELF/SyntheticSections.cpp
74adbee188SEd MasteSRCS+=		ELF/Target.cpp
75adbee188SEd MasteSRCS+=		ELF/Thunks.cpp
76adbee188SEd MasteSRCS+=		ELF/Writer.cpp
7706c3fb27SDimitry AndricSRCS+=		lld-driver.cpp
78adbee188SEd MasteSRCS+=		tools/lld/lld.cpp
79adbee188SEd Maste
80826e4397SEd Maste.include "${SRCTOP}/lib/clang/llvm.build.mk"
81adbee188SEd Maste
82adbee188SEd MasteLIBDEPS+=	llvm
83adbee188SEd Maste
84adbee188SEd Maste.for lib in ${LIBDEPS}
854c1492a1SDimitry AndricDPADD+=		${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a
86adbee188SEd MasteLDADD+=		${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a
87adbee188SEd Maste.endfor
88adbee188SEd Maste
89d8ed7fa3SDimitry AndricINCFILE=	Options.inc
90d8ed7fa3SDimitry AndricTDFILE=		${LLD_SRCS}/ELF/Options.td
91d8ed7fa3SDimitry AndricGENOPT=		-gen-opt-parser-defs
92d8ed7fa3SDimitry Andric${INCFILE}: ${TDFILE}
93d8ed7fa3SDimitry Andric	${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \
94d8ed7fa3SDimitry Andric	    -o ${.TARGET} ${TDFILE}
95d8ed7fa3SDimitry AndricTGHDRS+=	${INCFILE}
96adbee188SEd Maste
97fe6060f1SDimitry AndricDEPENDFILES+=	${TGHDRS:C/$/.d/}
98adbee188SEd MasteDPSRCS+=	${TGHDRS}
99adbee188SEd MasteCLEANFILES+=	${TGHDRS} ${TGHDRS:C/$/.d/}
100adbee188SEd Maste
10131ba4ce8SAlex Richardson.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)
102390be9fcSDimitry AndricLIBADD+=	execinfo
103cbc83e37SBaptiste DaroussinLIBADD+=	tinfow
10431ba4ce8SAlex Richardson.endif
105adbee188SEd MasteLIBADD+=	pthread
106adbee188SEd MasteLIBADD+=	z
107bdd1243dSDimitry AndricLIBADD+=	zstd
108adbee188SEd Maste
109adbee188SEd Maste.include <bsd.prog.mk>
110