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