bsd.sys.mk revision 114751
1# $FreeBSD: head/share/mk/bsd.sys.mk 114751 2003-05-05 21:13:32Z des $
2#
3# This file contains common settings used for building FreeBSD
4# sources.
5
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.
8
9# for GCC:  http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143
10
11.if !defined(NO_WARNS)
12. if defined(CSTD)
13.  if ${CSTD} == "k&r"
14CFLAGS          += -traditional
15.  elif ${CSTD} == "c89" || ${CSTD} == "c90"
16CFLAGS          += -std=iso9899:1990
17.  elif ${CSTD} == "c94" || ${CSTD} == "c95"
18CFLAGS          += -std=iso9899:199409
19.  elif ${CSTD} == "c99"
20CFLAGS          += -std=iso9899:1999
21.  else
22CFLAGS		+= -std=${CSTD}
23.  endif
24CFLAGS		+= -pedantic
25. endif
26. if defined(WARNS)
27.  if ${WARNS} > 0
28CFLAGS		+=	-Wsystem-headers
29.   if !defined(NO_WERROR)
30CFLAGS		+=	-Werror
31.   endif
32.  endif
33.  if ${WARNS} > 1
34CFLAGS		+=	-Wall -Wno-format-y2k
35.  endif
36.  if ${WARNS} > 2
37CFLAGS		+=	-W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
38.  endif
39.  if ${WARNS} > 3
40CFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
41.  endif
42# BDECFLAGS
43.  if ${WARNS} > 5
44CFLAGS		+=	-Wbad-function-cast -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
45.  endif
46.  if ${WARNS} > 1 && ${WARNS} < 5
47# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
48# XXX always get it right.
49CFLAGS		+=	-Wno-uninitialized
50.  endif
51. endif
52
53. if defined(FORMAT_AUDIT)
54WFORMAT		=	1
55. endif
56. if defined(WFORMAT)
57.  if ${WFORMAT} > 0
58#CFLAGS		+=	-Wformat-nonliteral -Wformat-security -Wno-format-extra-args
59CFLAGS		+=	-Wformat=2 -Wno-format-extra-args
60.   if !defined(NO_WERROR)
61CFLAGS		+=	-Werror
62.   endif
63.  endif
64. endif
65.endif
66
67# Allow user-specified additional warning flags
68CFLAGS		+=	${CWARNFLAGS}
69