]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/clang/llvm.build.mk
Merge ^/head r318964 through r319164.
[FreeBSD/FreeBSD.git] / lib / clang / llvm.build.mk
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
13 CFLAGS+=        -I${SRCTOP}/lib/clang/include
14 CFLAGS+=        -I${LLVM_SRCS}/include
15 CFLAGS+=        -DLLVM_BUILD_GLOBAL_ISEL
16 CFLAGS+=        -D__STDC_LIMIT_MACROS
17 CFLAGS+=        -D__STDC_CONSTANT_MACROS
18 #CFLAGS+=       -DNDEBUG
19
20 TARGET_ARCH?=   ${MACHINE_ARCH}
21 BUILD_ARCH?=    ${MACHINE_ARCH}
22
23 # Armv6 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:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
27 TARGET_ABI=     gnueabihf
28 .elif ${TARGET_ARCH:Marm*}
29 TARGET_ABI=     gnueabi
30 .else
31 TARGET_ABI=     unknown
32 .endif
33 OS_VERSION=     freebsd12.0
34
35 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${TARGET_ABI}-${OS_VERSION}
36 BUILD_TRIPLE?=  ${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-unknown-${OS_VERSION}
37
38 CFLAGS+=        -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\"
39 CFLAGS+=        -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\"
40 CFLAGS+=        -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
41
42 CFLAGS+=        -ffunction-sections
43 CFLAGS+=        -fdata-sections
44 LDFLAGS+=       -Wl,--gc-sections
45
46 CXXFLAGS+=      -std=c++11
47 CXXFLAGS+=      -fno-exceptions
48 CXXFLAGS+=      -fno-rtti
49 CXXFLAGS.clang+= -stdlib=libc++
50
51 .if ${MACHINE_CPUARCH} == "arm"
52 STATIC_CFLAGS+= -mlong-calls
53 STATIC_CXXFLAGS+= -mlong-calls
54 .endif