xref: /freebsd/usr.bin/clang/lld/Makefile (revision 02e9120893770924227138ba49df1edb3896112a)
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/X86.cpp
54SRCS+=		ELF/Arch/X86_64.cpp
55SRCS+=		ELF/CallGraphSort.cpp
56SRCS+=		ELF/DWARF.cpp
57SRCS+=		ELF/Driver.cpp
58SRCS+=		ELF/DriverUtils.cpp
59SRCS+=		ELF/EhFrame.cpp
60SRCS+=		ELF/ICF.cpp
61SRCS+=		ELF/InputFiles.cpp
62SRCS+=		ELF/InputSection.cpp
63SRCS+=		ELF/LTO.cpp
64SRCS+=		ELF/LinkerScript.cpp
65SRCS+=		ELF/MapFile.cpp
66SRCS+=		ELF/MarkLive.cpp
67SRCS+=		ELF/OutputSections.cpp
68SRCS+=		ELF/Relocations.cpp
69SRCS+=		ELF/ScriptLexer.cpp
70SRCS+=		ELF/ScriptParser.cpp
71SRCS+=		ELF/SymbolTable.cpp
72SRCS+=		ELF/Symbols.cpp
73SRCS+=		ELF/SyntheticSections.cpp
74SRCS+=		ELF/Target.cpp
75SRCS+=		ELF/Thunks.cpp
76SRCS+=		ELF/Writer.cpp
77SRCS+=		lld-driver.cpp
78SRCS+=		tools/lld/lld.cpp
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