bsd.sys.mk revision 99542
138032Speter# $FreeBSD: head/share/mk/bsd.sys.mk 99542 2002-07-07 18:47:52Z obrien $
238032Speter#
3261370Sgshapiro# This file contains common settings used for building FreeBSD
464562Sgshapiro# sources.
538032Speter
638032Speter# Enable various levels of compiler warning checks.  These may be
738032Speter# overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.
838032Speter
938032Speter# for GCC:  http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143
1038032Speter
1138032Speter.if !defined(NO_WARNS)
1238032Speter. if defined(WARNS)
1338032Speter.  if ${WARNS} > 0
1438032Speter.   if !defined(NO_WERROR)
1538032SpeterCFLAGS		+=	-Werror
1638032Speter.   endif
1738032Speter.  endif
1838032Speter.  if ${WARNS} > 1
1938032SpeterCFLAGS		+=	-Wall -Wno-format-y2k
2038032Speter.  endif
2138032Speter.  if ${WARNS} > 2
2238032SpeterCFLAGS		+=	-W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
2338032Speter.  endif
24266711Sgshapiro.  if ${WARNS} > 3
2538032SpeterCFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
2638032Speter.  endif
2738032Speter.  if ${WARNS} > 4
2838032SpeterCFLAGS		+=	-Wuninitialized
2938032Speter.  endif
3038032Speter# 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