]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/blob - share/mk/bsd.sys.mk
MFC r362623:
[FreeBSD/stable/8.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 # the default is gnu99 for now
12 CSTD            ?= gnu99
13
14 .if ${CC} != "icc"
15 . if ${CSTD} == "k&r"
16 CFLAGS          += -traditional
17 . elif ${CSTD} == "c89" || ${CSTD} == "c90"
18 CFLAGS          += -std=iso9899:1990
19 . elif ${CSTD} == "c94" || ${CSTD} == "c95"
20 CFLAGS          += -std=iso9899:199409
21 . elif ${CSTD} == "c99"
22 CFLAGS          += -std=iso9899:1999
23 . else
24 CFLAGS          += -std=${CSTD}
25 . endif
26 .endif
27 .if !defined(NO_WARNS) && ${CC} != "icc"
28 # -pedantic is problematic because it also imposes namespace restrictions
29 #CFLAGS         += -pedantic
30 . if defined(WARNS)
31 .  if ${WARNS} >= 1
32 CWARNFLAGS      +=      -Wsystem-headers
33 .   if !defined(NO_WERROR)
34 CWARNFLAGS      +=      -Werror
35 .   endif
36 .  endif
37 .  if ${WARNS} >= 2
38 CWARNFLAGS      +=      -Wall -Wno-format-y2k
39 .  endif
40 .  if ${WARNS} >= 3
41 CWARNFLAGS      +=      -W -Wno-unused-parameter -Wstrict-prototypes\
42                         -Wmissing-prototypes -Wpointer-arith
43 .  endif
44 .  if ${WARNS} >= 4
45 CWARNFLAGS      +=      -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
46                         -Wshadow -Wcast-align -Wunused-parameter
47 .  endif
48 # BDECFLAGS
49 .  if ${WARNS} >= 6
50 CWARNFLAGS      +=      -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
51 .  endif
52 .  if ${WARNS} >= 2 && ${WARNS} <= 4
53 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
54 # XXX always get it right.
55 CWARNFLAGS      +=      -Wno-uninitialized
56 .  endif
57 .  if !defined(WITH_GCC3)
58 CWARNFLAGS      +=      -Wno-pointer-sign
59 .  endif
60 . endif
61
62 . if defined(FORMAT_AUDIT)
63 WFORMAT         =       1
64 . endif
65 . if defined(WFORMAT)
66 .  if ${WFORMAT} > 0
67 #CWARNFLAGS     +=      -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
68 CWARNFLAGS      +=      -Wformat=2 -Wno-format-extra-args
69 .   if !defined(NO_WERROR)
70 CWARNFLAGS      +=      -Werror
71 .   endif
72 .  endif
73 . endif
74 . if defined(NO_WFORMAT)
75 CWARNFLAGS      +=      -Wno-format
76 . endif
77 .endif
78
79 .if defined(IGNORE_PRAGMA)
80 CWARNFLAGS      +=      -Wno-unknown-pragmas
81 .endif
82
83 .if ${MK_SSP} != "no" && ${CC} != "icc" && ${MACHINE_ARCH} != "ia64" && \
84         ${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "mips"
85 # Don't use -Wstack-protector as it breaks world with -Werror.
86 SSP_CFLAGS      ?=      -fstack-protector
87 CFLAGS          +=      ${SSP_CFLAGS}
88 .endif
89
90 # Allow user-specified additional warning flags
91 CFLAGS          +=      ${CWARNFLAGS}
92
93
94 # Tell bmake not to mistake standard targets for things to be searched for
95 # or expect to ever be up-to-date.
96 PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \
97                 beforelinking build build-tools buildfiles buildincludes \
98                 checkdpadd clean cleandepend cleandir cleanobj configure \
99                 depend dependall distclean distribute exe extract fetch \
100                 html includes install installfiles installincludes lint \
101                 obj objlink objs objwarn patch realall realdepend \
102                 realinstall regress subdir-all subdir-depend subdir-install \
103                 tags whereobj
104
105 .PHONY: ${PHONY_NOTMAIN}
106 .NOTMAIN: ${PHONY_NOTMAIN}