]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.sys.mk
This commit was generated by cvs2svn to compensate for changes in r165071,
[FreeBSD/FreeBSD.git] / share / mk / bsd.sys.mk
1 # $FreeBSD$
2 #
3 # This file contains common settings used for building FreeBSD
4 # sources.
5
6 # Enable various levels of compiler warning checks.  These may be
7 # overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.
8
9 # for GCC:  http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143
10
11 .if !defined(NO_WARNS) && ${CC} != "icc"
12 . if defined(CSTD)
13 .  if ${CSTD} == "k&r"
14 CFLAGS          += -traditional
15 .  elif ${CSTD} == "c89" || ${CSTD} == "c90"
16 CFLAGS          += -std=iso9899:1990
17 .  elif ${CSTD} == "c94" || ${CSTD} == "c95"
18 CFLAGS          += -std=iso9899:199409
19 .  elif ${CSTD} == "c99"
20 CFLAGS          += -std=iso9899:1999
21 .  else
22 CFLAGS          += -std=${CSTD}
23 .  endif
24 # -pedantic is problematic because it also imposes namespace restrictions
25 #CFLAGS         += -pedantic
26 . endif
27 . if defined(WARNS)
28 .  if ${WARNS} >= 1
29 CWARNFLAGS      +=      -Wsystem-headers
30 .   if !defined(NO_WERROR)
31 CWARNFLAGS      +=      -Werror
32 .   endif
33 .  endif
34 .  if ${WARNS} >= 2
35 CWARNFLAGS      +=      -Wall -Wno-format-y2k
36 .  endif
37 .  if ${WARNS} >= 3
38 CWARNFLAGS      +=      -W -Wno-unused-parameter -Wstrict-prototypes\
39                         -Wmissing-prototypes -Wpointer-arith
40 .  endif
41 .  if ${WARNS} >= 4
42 CWARNFLAGS      +=      -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
43                         -Wshadow -Wcast-align -Wunused-parameter
44 .  endif
45 # BDECFLAGS
46 .  if ${WARNS} >= 6
47 CWARNFLAGS      +=      -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
48 .  endif
49 .  if ${WARNS} >= 2 && ${WARNS} <= 4
50 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
51 # XXX always get it right.
52 CWARNFLAGS      +=      -Wno-uninitialized
53 .  endif
54 . endif
55
56 . if defined(FORMAT_AUDIT)
57 WFORMAT         =       1
58 . endif
59 . if defined(WFORMAT)
60 .  if ${WFORMAT} > 0
61 #CWARNFLAGS     +=      -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
62 CWARNFLAGS      +=      -Wformat=2 -Wno-format-extra-args
63 .   if !defined(NO_WERROR)
64 CWARNFLAGS      +=      -Werror
65 .   endif
66 .  endif
67 . endif
68 .endif
69
70 .if defined(IGNORE_PRAGMA)
71 CWARNFLAGS      +=      -Wno-unknown-pragmas
72 .endif
73
74 # Allow user-specified additional warning flags
75 CFLAGS          +=      ${CWARNFLAGS}