xref: /dragonfly/share/mk/bsd.sys.mk (revision 1847e88f)
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.7 2005/07/08 13:05:53 joerg 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# 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
22.    if ${CCVER} != gcc2
23CFLAGS		+=	-Wsystem-headers
24.    endif
25.endif
26.  if ${WARNS} > 1
27CFLAGS		+=	-Wall
28.  endif
29.  if ${WARNS} > 2
30CFLAGS		+=	-W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
31.  endif
32.  if ${WARNS} > 3
33CFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
34.  endif
35.  if ${WARNS} > 5
36CFLAGS		+=	-Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
37.  endif
38. endif
39
40. if defined(FORMAT_AUDIT)
41WFORMAT		=	1
42. endif
43. if defined(WFORMAT)
44.  if ${WFORMAT} > 0
45CFLAGS		+=	-Wno-format-extra-args
46.   if ${CCVER} == gcc2
47CFLAGS		+=	-Wnon-const-format
48.   endif
49.   if defined(WARNS_WERROR) && !defined(NO_WERROR)
50CFLAGS		+=	-Werror
51.   endif
52.  endif
53. endif
54.endif
55
56.if defined(WARNS_NO_UNUSED_PARAMETERS)
57CFLAGS+=	-Wno-unused-parameters
58.endif
59
60# Allow user-specified additional warning flags
61CFLAGS		+=	${CWARNFLAGS}
62