Merge branch 'vendor/GCC50' - gcc 5.0 snapshot 1 FEB 2015
[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      +=      -Wmissing-include-dirs -Wsystem-headers
27 .   if !defined(NO_WERROR) && (${CCVER} == "gcc44" || ${CCVER} == "gcc47")
28 CWARNFLAGS      +=      -Werror
29 .   endif
30 .  endif
31 .  if ${WARNS} >= 2
32 CWARNFLAGS      +=      -Wall -Wformat-security -Winit-self -Wno-pointer-sign
33 .  endif
34 .  if ${WARNS} >= 3
35 CWARNFLAGS      +=      -Wextra -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\
45                         -Wredundant-decls
46 .  endif
47 .  if ${WARNS} >= 2 && ${WARNS} <= 4
48 # XXX Delete -Wmaybe-uninitialized by default for now -- the compiler doesn't
49 # XXX always get it right.
50 .   if ${CCVER} == "gcc47"
51 CWARNFLAGS      +=      -Wno-maybe-uninitialized
52 .   else
53 CWARNFLAGS      +=      -Wno-uninitialized
54 .   endif
55 .  endif
56 # Activate gcc47's -Wunused-but-set-variable (which is in -Wall) and
57 # -Wunused-but-set-parameter (which is in -Wextra) only at WARNS >= 4
58 # (which is the level when also -Wunused-parameter comes into play).
59 .  if ${WARNS} >= 2 && ${WARNS} <= 3 && ${CCVER} == "gcc47"
60 CWARNFLAGS      +=      -Wno-unused-but-set-variable
61 .  endif
62 .  if ${WARNS} == 3 && ${CCVER} == "gcc47"
63 CWARNFLAGS      +=      -Wno-unused-but-set-parameter
64 .  endif
65 . endif
66
67 . if defined(FORMAT_AUDIT)
68 WFORMAT         =       1
69 . endif
70 . if defined(WFORMAT)
71 .  if ${WFORMAT} > 0
72 CWARNFLAGS      +=      -Wformat=2 -Wno-format-extra-args
73 .   if !defined(NO_WERROR) && (${CCVER} == "gcc47" || ${CCVER} == "gcc44")
74 CWARNFLAGS      +=      -Werror
75 .   endif
76 .  endif
77 . endif
78 .endif
79
80 # Allow user-specified additional warning flags
81 CFLAGS          +=      ${CWARNFLAGS}
82
83 # Tell bmake not to mistake standard targets for things to be searched for
84 # or expect to ever be up-to-date
85 PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \
86         beforelinking build build-tools buildfiles buildincludes \
87         checkdpadd clean cleandepend cleandir cleanobj configure \
88         depend dependall distclean distribute exe extract fetch \
89         html includes install installfiles installincludes lint \
90         obj objlink objs objwarn patch realall realdepend \
91         realinstall regress subdir-all subdir-depend subdir-install \
92         tags whereobj
93
94 .PHONY: ${PHONY_NOTMAIN}
95 .NOTMAIN: ${PHONY_NOTMAIN}