xref: /freebsd/usr.bin/clang/lld/Makefile (revision 4928135658a9d0eaee37003df6137ab363fcb0b4)
1# $FreeBSD$
2
3.include <src.opts.mk>
4
5LLVM_SRCS=	${SRCTOP}/contrib/llvm
6LLD_SRCS=	${LLVM_SRCS}/tools/lld
7
8PACKAGE=	lld
9PROG_CXX=	ld.lld
10
11.if ${MK_LLD_IS_LD} != "no"
12SYMLINKS=	${PROG_CXX} ${BINDIR}/ld
13MLINKS=		ld.lld.1 ld.1
14.endif
15
16CFLAGS+=	-I${LLD_SRCS}/ELF
17CFLAGS+=	-I${LLD_SRCS}/include
18CFLAGS+=	-I${.OBJDIR}
19CFLAGS+=	-I${OBJTOP}/lib/clang/libllvm
20
21SRCDIR=		tools/lld
22SRCS+=		Common/Args.cpp
23SRCS+=		Common/ErrorHandler.cpp
24SRCS+=		Common/Memory.cpp
25SRCS+=		Common/Reproduce.cpp
26SRCS+=		Common/Strings.cpp
27SRCS+=		Common/TargetOptionsCommandFlags.cpp
28SRCS+=		Common/Threads.cpp
29SRCS+=		Common/Version.cpp
30SRCS+=		ELF/AArch64ErrataFix.cpp
31SRCS+=		ELF/Arch/AArch64.cpp
32SRCS+=		ELF/Arch/AMDGPU.cpp
33SRCS+=		ELF/Arch/ARM.cpp
34SRCS+=		ELF/Arch/AVR.cpp
35SRCS+=		ELF/Arch/Mips.cpp
36SRCS+=		ELF/Arch/MipsArchTree.cpp
37SRCS+=		ELF/Arch/PPC.cpp
38SRCS+=		ELF/Arch/PPC64.cpp
39SRCS+=		ELF/Arch/SPARCV9.cpp
40SRCS+=		ELF/Arch/X86.cpp
41SRCS+=		ELF/Arch/X86_64.cpp
42SRCS+=		ELF/Driver.cpp
43SRCS+=		ELF/DriverUtils.cpp
44SRCS+=		ELF/EhFrame.cpp
45SRCS+=		ELF/Filesystem.cpp
46SRCS+=		ELF/GdbIndex.cpp
47SRCS+=		ELF/ICF.cpp
48SRCS+=		ELF/InputFiles.cpp
49SRCS+=		ELF/InputSection.cpp
50SRCS+=		ELF/LTO.cpp
51SRCS+=		ELF/LinkerScript.cpp
52SRCS+=		ELF/MapFile.cpp
53SRCS+=		ELF/MarkLive.cpp
54SRCS+=		ELF/OutputSections.cpp
55SRCS+=		ELF/Relocations.cpp
56SRCS+=		ELF/ScriptLexer.cpp
57SRCS+=		ELF/ScriptParser.cpp
58SRCS+=		ELF/Strings.cpp
59SRCS+=		ELF/SymbolTable.cpp
60SRCS+=		ELF/Symbols.cpp
61SRCS+=		ELF/SyntheticSections.cpp
62SRCS+=		ELF/Target.cpp
63SRCS+=		ELF/Thunks.cpp
64SRCS+=		ELF/Writer.cpp
65SRCS+=		lib/Core/Error.cpp
66SRCS+=		lib/Core/File.cpp
67SRCS+=		lib/Core/LinkingContext.cpp
68SRCS+=		lib/Core/Reader.cpp
69SRCS+=		lib/Core/Resolver.cpp
70SRCS+=		lib/Core/SymbolTable.cpp
71SRCS+=		tools/lld/lld.cpp
72
73.include "${SRCTOP}/lib/clang/llvm.build.mk"
74
75LIBDEPS+=	llvm
76
77.for lib in ${LIBDEPS}
78DPADD+=		${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a
79LDADD+=		${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a
80.endfor
81
82LLVM_TBLGEN?=	llvm-tblgen
83ELF/Options.inc: ${LLD_SRCS}/ELF/Options.td
84	${LLVM_TBLGEN} -gen-opt-parser-defs \
85	    -I ${LLVM_SRCS}/include \
86	    -d ${.TARGET:C/$/.d/} -o ${.TARGET} \
87	    ${LLVM_SRCS}/tools/lld/ELF/Options.td
88TGHDRS+=	ELF/Options.inc
89
90DPSRCS+=	${TGHDRS}
91CLEANFILES+=	${TGHDRS} ${TGHDRS:C/$/.d/}
92
93LIBADD+=	ncursesw
94LIBADD+=	pthread
95LIBADD+=	z
96
97.include <bsd.prog.mk>
98