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