xref: /dragonfly/share/mk/bsd.sys.mk (revision f02303f9)
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.9 2006/08/12 22:34:23 swildner Exp $
3#
4# This file contains common settings used for building DragonFly
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# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
13# XXX always get it right.
14.  if ${WARNS} <= 4
15CFLAGS		+=	-Wno-uninitialized
16.  endif
17.  if defined(WARNS_WERROR) && !defined(NO_WERROR)
18CFLAGS		+=	-Werror
19.  endif
20.  if ${WARNS} > 0
21CFLAGS		+=	-Wunknown-pragmas -Wsystem-headers
22.endif
23.  if ${WARNS} > 1
24CFLAGS		+=	-Wall
25.  endif
26.  if ${WARNS} > 2
27CFLAGS		+=	-W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
28.  endif
29.  if ${WARNS} > 3
30CFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
31.  endif
32.  if ${WARNS} > 5
33CFLAGS		+=	-Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
34.  endif
35. endif
36
37. if defined(FORMAT_AUDIT)
38WFORMAT		=	1
39. endif
40. if defined(WFORMAT)
41.  if ${WFORMAT} > 0
42CFLAGS		+=	-Wno-format-extra-args
43.   if defined(WARNS_WERROR) && !defined(NO_WERROR)
44CFLAGS		+=	-Werror
45.   endif
46.  endif
47. endif
48.endif
49
50.if defined(WARNS_NO_UNUSED_PARAMETERS)
51CFLAGS+=	-Wno-unused-parameters
52.endif
53
54# Allow user-specified additional warning flags
55CFLAGS		+=	${CWARNFLAGS}
56