xref: /freebsd/lib/clang/llvm.build.mk (revision 3416500aef140042c64bc149cb1ec6620483bc44)
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_ON_UNIX
16CFLAGS+=	-DLLVM_ON_FREEBSD
17CFLAGS+=	-D__STDC_LIMIT_MACROS
18CFLAGS+=	-D__STDC_CONSTANT_MACROS
19#CFLAGS+=	-DNDEBUG
20
21TARGET_ARCH?=	${MACHINE_ARCH}
22BUILD_ARCH?=	${MACHINE_ARCH}
23
24# Armv6 uses hard float abi, unless the CPUTYPE has soft in it.
25# arm (for armv4 and armv5 CPUs) always uses the soft float ABI.
26# For all other targets, we stick with 'unknown'.
27.if ${TARGET_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
28TARGET_ABI=	-gnueabihf
29.elif ${TARGET_ARCH:Marm*}
30TARGET_ABI=	-gnueabi
31.else
32TARGET_ABI=
33.endif
34VENDOR=		unknown
35OS_VERSION=	freebsd12.0
36
37TARGET_TRIPLE?=	${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI}
38BUILD_TRIPLE?=	${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}
39
40CFLAGS+=	-DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\"
41CFLAGS+=	-DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\"
42CFLAGS+=	-DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
43
44CFLAGS+=	-ffunction-sections
45CFLAGS+=	-fdata-sections
46LDFLAGS+=	-Wl,--gc-sections
47
48CXXFLAGS+=	-std=c++11
49CXXFLAGS+=	-fno-exceptions
50CXXFLAGS+=	-fno-rtti
51CXXFLAGS.clang+= -stdlib=libc++
52
53.if ${MACHINE_CPUARCH} == "arm"
54STATIC_CFLAGS+= -mlong-calls
55STATIC_CXXFLAGS+= -mlong-calls
56.endif
57