Revert "bsd.sys.mk: support -Wunused-local-typedef"
[dragonfly.git] / share / mk / bsd.sys.mk
blobf16b18713536d9baa0f26eff3876582f366d7494
1 # $FreeBSD: src/share/mk/bsd.sys.mk,v 1.3.2.5 2002/07/03 16:59:14 des Exp $
3 # This file contains common settings used for building DragonFly
4 # sources.
6 CSTD?= gnu99
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
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.
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:Mgcc*}
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:Mgcc*}
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:Mgcc*}
60 CWARNFLAGS += -Wno-unused-but-set-variable
61 . endif
62 . if ${WARNS} == 3 && ${CCVER:Mgcc*}
63 CWARNFLAGS += -Wno-unused-but-set-parameter
64 . endif
65 . if ${WARNS} == 3 && (${CCVER:Mgcc49} || ${CCVER:Mgcc5*})
66 CWARNFLAGS += -Wno-unused-value
67 . endif
68 . if ${WARNS} >= 2 && ${CCVER:Mgcc4[789]}
69 CWARNFLAGS += -Wno-error=maybe-uninitialized\
70 -Wno-error=uninitialized\
71 -Wno-error=shadow
72 . endif
73 # Disable -Werror selectively for -Os and -Og compilations. Both -Winline and
74 # -Wmaybe-uninitialized are noisy and should be caught by standard -O and -O2.
75 # These are still useful diagnostics while investigating compilation issues.
76 . if defined(WORLD_CCOPTLEVEL) && (${WORLD_CCOPTLEVEL:Mg} || ${WORLD_CCOPTLEVEL:Ms})
77 . if ${WARNS} >= 6
78 CWARNFLAGS += -Wno-error=inline
79 . endif
80 . if ${WARNS} >= 5 && ${CCVER:Mgcc*}
81 CWARNFLAGS += -Wno-error=maybe-uninitialized
82 . endif
83 . endif
84 . endif
86 . if defined(FORMAT_AUDIT)
87 WFORMAT = 1
88 . endif
89 . if defined(WFORMAT)
90 . if ${WFORMAT} > 0
91 CWARNFLAGS += -Wformat=2 -Wno-format-extra-args
92 . if !defined(NO_WERROR) && ${CCVER:Mgcc*}
93 CWARNFLAGS += -Werror
94 . endif
95 . endif
96 . endif
97 .endif
99 .if defined(NO_WARRAY_BOUNDS)
100 CWARNFLAGS += -Wno-array-bounds
101 .endif
102 .if defined(NO_STRICT_OVERFLOW)
103 CFLAGS += -fno-strict-overflow
104 .endif
105 .if defined(NO_STRICT_ALIASING)
106 CFLAGS += -fno-strict-aliasing
107 .endif
110 # Allow user-specified additional warning flags
111 CFLAGS += ${CWARNFLAGS}
113 # Tell bmake not to mistake standard targets for things to be searched for
114 # or expect to ever be up-to-date
115 PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \
116 beforelinking build build-tools buildfiles buildincludes \
117 checkdpadd clean cleandepend cleandir cleanobj configure \
118 depend dependall distclean distribute exe extract fetch \
119 html includes install installfiles installincludes lint \
120 obj objlink objs objwarn patch realall realdepend \
121 realinstall regress subdir-all subdir-depend subdir-install \
122 tags whereobj
124 # if given PROG matches anything in the PHONY list, exclude it.
125 .PHONY: ${PHONY_NOTMAIN:N${PROG:U}}
126 .NOTMAIN: ${PHONY_NOTMAIN}