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