Merge branch 'vendor/DIFFUTILS'
[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 #
3 # This file contains common settings used for building DragonFly
4 # sources.
5
6 CSTD?=  gnu99
7
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
20 # Enable various levels of compiler warning checks.  These may be
21 # overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.
22
23 .if !defined(NO_WARNS)
24 . if defined(WARNS)
25 .  if ${WARNS} >= 1
26 CWARNFLAGS      +=      -Wsystem-headers
27 .   if !defined(NO_WERROR) && (${CCVER} == "gcc41" || ${CCVER} == "gcc44")
28 CWARNFLAGS      +=      -Werror
29 .   endif
30 .  endif
31 .  if ${WARNS} >= 2
32 CWARNFLAGS      +=      -Wall
33 .  endif
34 .  if ${WARNS} >= 3
35 CWARNFLAGS      +=      -W -Wno-unused-parameter -Wstrict-prototypes\
36                         -Wmissing-prototypes -Wpointer-arith\
37                         -Wold-style-definition
38 .  endif
39 .  if ${WARNS} >= 4
40 CWARNFLAGS      +=      -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
41                         -Wshadow -Wcast-align -Wunused-parameter
42 .  endif
43 .  if ${WARNS} >= 6
44 CWARNFLAGS      +=      -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
45 .  endif
46 .  if ${WARNS} >= 2 && ${WARNS} <= 4
47 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
48 # XXX always get it right.
49 CWARNFLAGS      +=      -Wno-uninitialized
50 .  endif
51 . endif
52
53 . if defined(FORMAT_AUDIT)
54 WFORMAT         =       1
55 . endif
56 . if defined(WFORMAT)
57 .  if ${WFORMAT} > 0
58 CWARNFLAGS      +=      -Wformat=2 -Wno-format-extra-args
59 .   if !defined(NO_WERROR) && (${CCVER} == "gcc41" || ${CCVER} == "gcc44")
60 CWARNFLAGS      +=      -Werror
61 .   endif
62 .  endif
63 . endif
64 .endif
65
66 # Allow user-specified additional warning flags
67 CFLAGS          +=      ${CWARNFLAGS}