xref: /dragonfly/share/mk/bsd.sys.mk (revision d5f516c3)
1# $FreeBSD: src/share/mk/bsd.sys.mk,v 1.3.2.5 2002/07/03 16:59:14 des Exp $
2# $DragonFly: src/share/mk/bsd.sys.mk,v 1.4 2004/07/22 13:41:25 asmodai Exp $
3#
4# This file contains common settings used for building FreeBSD
5# sources.
6
7# Enable various levels of compiler warning checks.  These may be
8# overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.
9
10.if !defined(NO_WARNS)
11. if defined(WARNS)
12.  if ${WARNS} > 0
13CFLAGS		+=	-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
14# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
15# XXX always get it right.
16CFLAGS		+=	-Wno-uninitialized
17.   if defined(WARNS_WERROR) && !defined(NO_WERROR)
18CFLAGS		+=	-Werror
19.   endif
20.  endif
21.  if ${WARNS} > 1
22CFLAGS		+=	-Wall
23.  endif
24.  if ${WARNS} > 2
25CFLAGS		+=	-W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
26.  endif
27.  if ${WARNS} > 3
28CFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
29.  endif
30.  if ${WARNS} > 5
31CFLAGS		+=	-Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
32.  endif
33. endif
34
35. if defined(FORMAT_AUDIT)
36WFORMAT		=	1
37. endif
38. if defined(WFORMAT)
39.  if ${WFORMAT} > 0
40CFLAGS		+=	-Wnon-const-format -Wno-format-extra-args
41.   if defined(WARNS_WERROR) && !defined(NO_WERROR)
42CFLAGS		+=	-Werror
43.   endif
44.  endif
45. endif
46.endif
47
48# Allow user-specified additional warning flags
49CFLAGS		+=	${CWARNFLAGS}
50
51