xref: /freebsd/lib/clang/llvm.build.mk (revision 63a938566d524836885917d95bd491aa4400b181)
1# $FreeBSD$
2
3.ifndef LLVM_SRCS
4.error Please define LLVM_SRCS before including this file
5.endif
6
7.ifndef SRCDIR
8.error Please define SRCDIR before including this file
9.endif
10
11.PATH:		${LLVM_SRCS}/${SRCDIR}
12
13CFLAGS+=	-I${SRCTOP}/lib/clang/include
14CFLAGS+=	-I${LLVM_SRCS}/include
15CFLAGS+=	-DLLVM_BUILD_GLOBAL_ISEL
16CFLAGS+=	-D__STDC_LIMIT_MACROS
17CFLAGS+=	-D__STDC_CONSTANT_MACROS
18#CFLAGS+=	-DNDEBUG
19
20TARGET_ARCH?=	${MACHINE_ARCH}
21BUILD_ARCH?=	${MACHINE_ARCH}
22
23# Armv6 and armv7 uses hard float abi, unless the CPUTYPE has soft in it.
24# arm (for armv4 and armv5 CPUs) always uses the soft float ABI.
25# For all other targets, we stick with 'unknown'.
26.if ${TARGET_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
27TARGET_ABI=	-gnueabihf
28.elif ${TARGET_ARCH:Marm*}
29TARGET_ABI=	-gnueabi
30.else
31TARGET_ABI=
32.endif
33VENDOR=		unknown
34OS_VERSION=	freebsd12.0
35
36LLVM_TARGET_TRIPLE?=	${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI}
37LLVM_BUILD_TRIPLE?=	${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}
38
39CFLAGS+=	-DLLVM_DEFAULT_TARGET_TRIPLE=\"${LLVM_TARGET_TRIPLE}\"
40CFLAGS+=	-DLLVM_HOST_TRIPLE=\"${LLVM_BUILD_TRIPLE}\"
41CFLAGS+=	-DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
42
43CFLAGS+=	-ffunction-sections
44CFLAGS+=	-fdata-sections
45LDFLAGS+=	-Wl,--gc-sections
46
47CXXFLAGS+=	-std=c++11
48CXXFLAGS+=	-fno-exceptions
49CXXFLAGS+=	-fno-rtti
50CXXFLAGS.clang+= -stdlib=libc++
51
52.if ${MACHINE_CPUARCH} == "arm"
53STATIC_CFLAGS+= -mlong-calls
54STATIC_CXXFLAGS+= -mlong-calls
55.endif
56