aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/clang/lld/Makefile
blob: 8e95ccc07f046ac995f41564e1b2b60526325bfb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# $FreeBSD$

.include <src.opts.mk>

LLVM_BASE=	${SRCTOP}/contrib/llvm-project
LLVM_SRCS=	${LLVM_BASE}/llvm
LLD_SRCS=	${LLVM_BASE}/lld

PACKAGE=	lld
PROG_CXX=	ld.lld
# Man page directory
.PATH:		${LLD_SRCS}/docs
.if (!defined(TOOLS_PREFIX) && ${MK_LLD_IS_LD} != "no") || \
    (defined(TOOLS_PREFIX) && ${MK_LLD_BOOTSTRAP} != "no")
SYMLINKS=	${PROG_CXX} ${BINDIR}/ld
MLINKS=		ld.lld.1 ld.1
.endif

.if ${MK_SHARED_TOOLCHAIN} == "no"
NO_SHARED?= yes
.endif

CFLAGS+=	-I${LLD_SRCS}/ELF
CFLAGS+=	-I${LLD_SRCS}/include
CFLAGS+=	-I${.OBJDIR}
CFLAGS+=	-I${OBJTOP}/lib/clang/libllvm

SRCDIR=		lld
SRCS+=		Common/Args.cpp
SRCS+=		Common/DWARF.cpp
SRCS+=		Common/ErrorHandler.cpp
SRCS+=		Common/Filesystem.cpp
SRCS+=		Common/Memory.cpp
SRCS+=		Common/Reproduce.cpp
SRCS+=		Common/Strings.cpp
SRCS+=		Common/TargetOptionsCommandFlags.cpp
SRCS+=		Common/Version.cpp
SRCS+=		ELF/AArch64ErrataFix.cpp
SRCS+=		ELF/ARMErrataFix.cpp
SRCS+=		ELF/Arch/AArch64.cpp
SRCS+=		ELF/Arch/AMDGPU.cpp
SRCS+=		ELF/Arch/ARM.cpp
SRCS+=		ELF/Arch/AVR.cpp
SRCS+=		ELF/Arch/Hexagon.cpp
SRCS+=		ELF/Arch/MSP430.cpp
SRCS+=		ELF/Arch/Mips.cpp
SRCS+=		ELF/Arch/MipsArchTree.cpp
SRCS+=		ELF/Arch/PPC.cpp
SRCS+=		ELF/Arch/PPC64.cpp
SRCS+=		ELF/Arch/RISCV.cpp
SRCS+=		ELF/Arch/SPARCV9.cpp
SRCS+=		ELF/Arch/X86.cpp
SRCS+=		ELF/Arch/X86_64.cpp
SRCS+=		ELF/CallGraphSort.cpp
SRCS+=		ELF/DWARF.cpp
SRCS+=		ELF/Driver.cpp
SRCS+=		ELF/DriverUtils.cpp
SRCS+=		ELF/EhFrame.cpp
SRCS+=		ELF/ICF.cpp
SRCS+=		ELF/InputFiles.cpp
SRCS+=		ELF/InputSection.cpp
SRCS+=		ELF/LTO.cpp
SRCS+=		ELF/LinkerScript.cpp
SRCS+=		ELF/MapFile.cpp
SRCS+=		ELF/MarkLive.cpp
SRCS+=		ELF/OutputSections.cpp
SRCS+=		ELF/Relocations.cpp
SRCS+=		ELF/ScriptLexer.cpp
SRCS+=		ELF/ScriptParser.cpp
SRCS+=		ELF/SymbolTable.cpp
SRCS+=		ELF/Symbols.cpp
SRCS+=		ELF/SyntheticSections.cpp
SRCS+=		ELF/Target.cpp
SRCS+=		ELF/Thunks.cpp
SRCS+=		ELF/Writer.cpp
SRCS+=		lib/Core/Error.cpp
SRCS+=		lib/Core/File.cpp
SRCS+=		lib/Core/LinkingContext.cpp
SRCS+=		lib/Core/Reader.cpp
SRCS+=		lib/Core/Resolver.cpp
SRCS+=		lib/Core/SymbolTable.cpp
SRCS+=		tools/lld/lld.cpp

.include "${SRCTOP}/lib/clang/llvm.build.mk"

LIBDEPS+=	llvm

.for lib in ${LIBDEPS}
DPADD+=		${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a
LDADD+=		${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a
.endfor

LLVM_TBLGEN?=	llvm-tblgen
INCFILE=	Options.inc
TDFILE=		${LLD_SRCS}/ELF/Options.td
GENOPT=		-gen-opt-parser-defs
${INCFILE}: ${TDFILE}
	${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \
	    -o ${.TARGET} ${TDFILE}
TGHDRS+=	${INCFILE}

DPSRCS+=	${TGHDRS}
CLEANFILES+=	${TGHDRS} ${TGHDRS:C/$/.d/}

.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)
LIBADD+=	execinfo
LIBADD+=	ncursesw
.endif
LIBADD+=	pthread
LIBADD+=	z

.include <bsd.prog.mk>