bsd.sys.mk revision 96316
1# $FreeBSD: head/share/mk/bsd.sys.mk 96316 2002-05-10 01:58:16Z obrien $
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(WARNS)
13.  if ${WARNS} > 0
14.   if !defined(NO_WERROR)
15CFLAGS		+=	-Werror
16.   endif
17.  endif
18.  if ${WARNS} > 1
19CFLAGS		+=	-Wall -Wno-format-y2k
20.  endif
21.  if ${WARNS} > 2
22CFLAGS		+=	-W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
23.  endif
24.  if ${WARNS} > 3
25CFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
26.  endif
27.  if ${WARNS} > 4
28CFLAGS		+=	-Wuninitialized
29.  endif
30# BDECFLAGS
31.  if ${WARNS} > 5
32CFLAGS		+=	-ansi -pedantic -Wbad-function-cast -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
33.  endif
34.  if ${WARNS} > 1 && ${WARNS} < 5
35# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
36# XXX always get it right.
37CFLAGS		+=	-Wno-uninitialized
38.  endif
39. endif
40
41. if defined(FORMAT_AUDIT)
42WFORMAT		=	1
43. endif
44. if defined(WFORMAT)
45.  if ${WFORMAT} > 0
46#CFLAGS		+=	-Wformat-nonliteral -Wformat-security -Wno-format-extra-args
47CFLAGS		+=	-Wformat=2 -Wno-format-extra-args
48.   if !defined(NO_WERROR)
49CFLAGS		+=	-Werror
50.   endif
51.  endif
52. endif
53.endif
54
55# Allow user-specified additional warning flags
56CFLAGS		+=	${CWARNFLAGS}
57
58# FreeBSD prior to 4.5 didn't have the __FBSDID() macro in <sys/cdefs.h>.
59.if defined(BOOTSTRAPPING)
60CFLAGS+=	-D__FBSDID=__RCSID
61.endif
62