Move CSTD out of NO_WARNS (i.e., it shall apply too if NO_WARNS is set).
[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.12 2008/11/14 15:04:42 swildner Exp $
3 #
4 # This file contains common settings used for building DragonFly
5 # sources.
6
7 .if defined(CSTD)
8 . if ${CSTD} == "k&r"
9 CFLAGS          += -traditional
10 . elif ${CSTD} == "c89" || ${CSTD} == "c90"
11 CFLAGS          += -std=iso9899:1990
12 . elif ${CSTD} == "c94" || ${CSTD} == "c95"
13 CFLAGS          += -std=iso9899:199409
14 . elif ${CSTD} == "c99"
15 CFLAGS          += -std=iso9899:1999
16 . else
17 CFLAGS          += -std=${CSTD}
18 . endif
19 .endif
20
21 # Enable various levels of compiler warning checks.  These may be
22 # overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.
23
24 .if !defined(NO_WARNS)
25 . if defined(WARNS)
26 .  if ${WARNS} >= 1
27 CWARNFLAGS      +=      -Wsystem-headers
28 .   if !defined(NO_WERROR) && ${CCVER} == "gcc41"
29 CWARNFLAGS      +=      -Werror
30 .   endif
31 .  endif
32 .  if ${WARNS} >= 2
33 CWARNFLAGS      +=      -Wall
34 .  endif
35 .  if ${WARNS} >= 3
36 CWARNFLAGS      +=      -W -Wno-unused-parameter -Wstrict-prototypes\
37                         -Wmissing-prototypes -Wpointer-arith\
38                         -Wold-style-definition
39 .  endif
40 .  if ${WARNS} >= 4
41 CWARNFLAGS      +=      -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
42                         -Wshadow -Wcast-align -Wunused-parameter
43 .  endif
44 .  if ${WARNS} >= 6
45 CWARNFLAGS      +=      -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
46 .  endif
47 .  if ${WARNS} >= 2 && ${WARNS} <= 4
48 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
49 # XXX always get it right.
50 CWARNFLAGS      +=      -Wno-uninitialized
51 .  endif
52 . endif
53
54 . if defined(FORMAT_AUDIT)
55 WFORMAT         =       1
56 . endif
57 . if defined(WFORMAT)
58 .  if ${WFORMAT} > 0
59 CWARNFLAGS      +=      -Wformat=2 -Wno-format-extra-args
60 .   if !defined(NO_WERROR) && ${CCVER} == "gcc41"
61 CWARNFLAGS      +=      -Werror
62 .   endif
63 .  endif
64 . endif
65 .endif
66
67 # Allow user-specified additional warning flags
68 CFLAGS          +=      ${CWARNFLAGS}