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