turns printfs back on
[freebsd-src/fkvm-freebsd.git] / share / mk / bsd.sys.mk
blob197c1d670596cf387aa2f2c1d5a4836d6052b5ef
1 # $FreeBSD$
3 # This file contains common settings used for building FreeBSD
4 # sources.
6 # Enable various levels of compiler warning checks. These may be
7 # overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.
9 # for GCC: http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143
11 .if !defined(NO_WARNS) && ${CC} != "icc"
12 . if defined(CSTD)
13 . if ${CSTD} == "k&r"
14 CFLAGS += -traditional
15 . elif ${CSTD} == "c89" || ${CSTD} == "c90"
16 CFLAGS += -std=iso9899:1990
17 . elif ${CSTD} == "c94" || ${CSTD} == "c95"
18 CFLAGS += -std=iso9899:199409
19 . elif ${CSTD} == "c99"
20 CFLAGS += -std=iso9899:1999
21 . else
22 CFLAGS += -std=${CSTD}
23 . endif
24 # -pedantic is problematic because it also imposes namespace restrictions
25 #CFLAGS += -pedantic
26 . endif
27 . if defined(WARNS)
28 . if ${WARNS} >= 1
29 CWARNFLAGS += -Wsystem-headers
30 . if !defined(NO_WERROR)
31 CWARNFLAGS += -Werror
32 . endif
33 . endif
34 . if ${WARNS} >= 2
35 CWARNFLAGS += -Wall -Wno-format-y2k
36 . endif
37 . if ${WARNS} >= 3
38 CWARNFLAGS += -W -Wno-unused-parameter -Wstrict-prototypes\
39 -Wmissing-prototypes -Wpointer-arith
40 . endif
41 . if ${WARNS} >= 4
42 CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
43 -Wshadow -Wcast-align -Wunused-parameter
44 . endif
45 # BDECFLAGS
46 . if ${WARNS} >= 6
47 CWARNFLAGS += -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
48 . endif
49 . if ${WARNS} >= 2 && ${WARNS} <= 4
50 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
51 # XXX always get it right.
52 CWARNFLAGS += -Wno-uninitialized
53 . endif
54 . if !defined(WITH_GCC3)
55 CWARNFLAGS += -Wno-pointer-sign
56 . endif
57 . endif
59 . if defined(FORMAT_AUDIT)
60 WFORMAT = 1
61 . endif
62 . if defined(WFORMAT)
63 . if ${WFORMAT} > 0
64 #CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
65 CWARNFLAGS += -Wformat=2 -Wno-format-extra-args
66 . if !defined(NO_WERROR)
67 CWARNFLAGS += -Werror
68 . endif
69 . endif
70 . endif
71 .endif
73 .if defined(IGNORE_PRAGMA)
74 CWARNFLAGS += -Wno-unknown-pragmas
75 .endif
77 .if ${MK_SSP} != "no" && ${CC} != "icc" && ${MACHINE_ARCH} != "ia64" && \
78 ${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "mips"
79 # Don't use -Wstack-protector as it breaks world with -Werror.
80 SSP_CFLAGS ?= -fstack-protector
81 CFLAGS += ${SSP_CFLAGS}
82 .endif
84 # Allow user-specified additional warning flags
85 CFLAGS += ${CWARNFLAGS}