New upstream version 18.02
[deb_dpdk.git] / mk / toolchain / clang / rte.vars.mk
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2014 Intel Corporation
3
4 #
5 # toolchain:
6 #
7 #   - define CC, LD, AR, AS, ... (overridden by cmdline value)
8 #   - define TOOLCHAIN_CFLAGS variable (overridden by cmdline value)
9 #   - define TOOLCHAIN_LDFLAGS variable (overridden by cmdline value)
10 #   - define TOOLCHAIN_ASFLAGS variable (overridden by cmdline value)
11 #
12
13 CC        = $(CROSS)clang
14 KERNELCC  = $(CROSS)gcc
15 CPP       = $(CROSS)cpp
16 # for now, we don't use as but nasm.
17 # AS      = $(CROSS)as
18 AS        = nasm
19 AR        = $(CROSS)ar
20 LD        = $(CROSS)ld
21 OBJCOPY   = $(CROSS)objcopy
22 OBJDUMP   = $(CROSS)objdump
23 STRIP     = $(CROSS)strip
24 READELF   = $(CROSS)readelf
25 GCOV      = $(CROSS)gcov
26
27 ifeq ("$(origin CC)", "command line")
28 HOSTCC    = $(CC)
29 else
30 HOSTCC    = clang
31 endif
32 HOSTAS    = as
33
34 TOOLCHAIN_ASFLAGS =
35 TOOLCHAIN_CFLAGS =
36 TOOLCHAIN_LDFLAGS =
37
38 WERROR_FLAGS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
39 WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
40 WERROR_FLAGS += -Wnested-externs -Wcast-qual
41 WERROR_FLAGS += -Wformat-nonliteral -Wformat-security
42 WERROR_FLAGS += -Wundef -Wwrite-strings -Wdeprecated
43
44 ifeq ($(RTE_DEVEL_BUILD),y)
45 WERROR_FLAGS += -Werror
46 endif
47
48 # process cpu flags
49 include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk
50
51 # workaround clang bug with warning "missing field initializer" for "= {0}"
52 WERROR_FLAGS += -Wno-missing-field-initializers
53
54 # disable packed member unalign warnings
55 ifeq ($(shell test $(CLANG_MAJOR_VERSION) -ge 4 && echo 1), 1)
56 WERROR_FLAGS += -Wno-address-of-packed-member
57 endif
58
59 export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF
60 export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS