xref: /freebsd/usr.bin/clang/lld/Makefile (revision 6580f5c38dd5b01aeeaed16b370f1a12423437f0)
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) || \
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/DriverDispatcher.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/LoongArch.cpp
46SRCS+=		ELF/Arch/MSP430.cpp
47SRCS+=		ELF/Arch/Mips.cpp
48SRCS+=		ELF/Arch/MipsArchTree.cpp
49SRCS+=		ELF/Arch/PPC.cpp
50SRCS+=		ELF/Arch/PPC64.cpp
51SRCS+=		ELF/Arch/RISCV.cpp
52SRCS+=		ELF/Arch/SPARCV9.cpp
53SRCS+=		ELF/Arch/SystemZ.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+=		lld-driver.cpp
79SRCS+=		tools/lld/lld.cpp
80
81.include "${SRCTOP}/lib/clang/llvm.build.mk"
82
83LIBDEPS+=	llvm
84
85.for lib in ${LIBDEPS}
86DPADD+=		${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a
87LDADD+=		${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a
88.endfor
89
90INCFILE=	Options.inc
91TDFILE=		${LLD_SRCS}/ELF/Options.td
92GENOPT=		-gen-opt-parser-defs
93${INCFILE}: ${TDFILE}
94	${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \
95	    -o ${.TARGET} ${TDFILE}
96TGHDRS+=	${INCFILE}
97
98DEPENDFILES+=	${TGHDRS:C/$/.d/}
99DPSRCS+=	${TGHDRS}
100CLEANFILES+=	${TGHDRS} ${TGHDRS:C/$/.d/}
101
102.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)
103LIBADD+=	execinfo
104LIBADD+=	tinfow
105.endif
106LIBADD+=	pthread
107LIBADD+=	z
108LIBADD+=	zstd
109
110.include <bsd.prog.mk>
111