Merge from vendor branch FILE:
[dragonfly.git] / share / mk / bsd.sys.mk
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.6 2005/03/09 16:12:29 corecode 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
15 CFLAGS          +=      -Wno-uninitialized
16 .  endif
17 .  if defined(WARNS_WERROR) && !defined(NO_WERROR)
18 CFLAGS          +=      -Werror
19 .  endif
20 .  if ${WARNS} > 0
21 CFLAGS          +=      -Wunknown-pragmas
22 .    if ${CCVER} != gcc2
23 CFLAGS          +=      -Wsystem-headers
24 .    endif
25 .endif
26 .  if ${WARNS} > 1
27 CFLAGS          +=      -Wall
28 .  endif
29 .  if ${WARNS} > 2
30 CFLAGS          +=      -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
31 .  endif
32 .  if ${WARNS} > 3
33 CFLAGS          +=      -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
34 .  endif
35 .  if ${WARNS} > 5
36 CFLAGS          +=      -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
37 .  endif
38 . endif
39
40 . if defined(FORMAT_AUDIT)
41 WFORMAT         =       1
42 . endif
43 . if defined(WFORMAT)
44 .  if ${WFORMAT} > 0
45 CFLAGS          +=      -Wno-format-extra-args
46 .   if ${CCVER} == gcc2
47 CFLAGS          +=      -Wnon-const-format
48 .   endif
49 .   if defined(WARNS_WERROR) && !defined(NO_WERROR)
50 CFLAGS          +=      -Werror
51 .   endif
52 .  endif
53 . endif
54 .endif
55
56 # Allow user-specified additional warning flags
57 CFLAGS          +=      ${CWARNFLAGS}