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