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
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
17 CFLAGS
+= -std
=${CSTD}
20 # Explicitly clear _cnowarnflags (should not be used in Makefiles).
23 # Enable various levels of compiler warning checks. These may be
24 # overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.
26 .if
!defined
(NO_WARNS
)
29 CWARNFLAGS
+= -Wmissing-include-dirs
-Wsystem-headers
30 . if
!defined
(NO_WERROR
) && (${CCVER} == "gcc47" ||
${CCVER} == "gcc50")
35 CWARNFLAGS
+= -Wall
-Wformat-security
-Winit-self
36 _cnowarnflags
+= -Wno-pointer-sign
39 CWARNFLAGS
+= -Wextra
-Wstrict-prototypes\
40 -Wmissing-prototypes
-Wpointer-arith\
41 -Wold-style-definition
42 _cnowarnflags
+= -Wno-unused-parameter
45 CWARNFLAGS
+= -Wreturn-type
-Wcast-qual
-Wwrite-strings
-Wswitch\
46 -Wshadow
-Wcast-align
-Wunused-parameter
49 CWARNFLAGS
+= -Wchar-subscripts
-Winline
-Wnested-externs\
52 . if
${WARNS} >= 2 && ${WARNS} <= 4
53 # XXX Delete -Wmaybe-uninitialized by default for now -- the compiler doesn't
54 # XXX always get it right.
56 _cnowarnflags
+= -Wno-maybe-uninitialized
58 _cnowarnflags
+= -Wno-uninitialized
61 # Activate gcc47's -Wunused-but-set-variable (which is in -Wall) and
62 # -Wunused-but-set-parameter (which is in -Wextra) only at WARNS >= 4
63 # (which is the level when also -Wunused-parameter comes into play).
64 . if
${WARNS} >= 2 && ${WARNS} <= 3 && ${CCVER
:Mgcc
*}
65 _cnowarnflags
+= -Wno-unused-but-set-variable
67 . if
${WARNS} == 3 && ${CCVER
:Mgcc
*}
68 _cnowarnflags
+= -Wno-unused-but-set-parameter
70 . if
${WARNS} == 3 && (${CCVER
:Mgcc49
} ||
${CCVER
:Mgcc
[5-]*})
71 _cnowarnflags
+= -Wno-unused-value
73 . if
${WARNS} >= 2 && ${CCVER
:Mgcc4
[789]}
74 _cnowarnflags
+= -Wno-error
=maybe-uninitialized\
75 -Wno-error
=uninitialized\
78 # Disable -Werror selectively for -Os and -Og compilations. Both -Winline and
79 # -Wmaybe-uninitialized are noisy and should be caught by standard -O and -O2.
80 # These are still useful diagnostics while investigating compilation issues.
81 . if defined
(WORLD_CCOPTLEVEL
) && (${WORLD_CCOPTLEVEL
:Mg
} ||
${WORLD_CCOPTLEVEL
:Ms
})
83 CWARNFLAGS
+= -Wno-error
=inline
85 . if
${WARNS} >= 5 && ${CCVER
:Mgcc
*}
86 CWARNFLAGS
+= -Wno-error
=maybe-uninitialized
91 . if defined
(FORMAT_AUDIT
)
96 CWARNFLAGS
+= -Wformat
=2
97 . if
!defined
(NO_WERROR
) && (${CCVER} == "gcc47" ||
${CCVER} == "gcc50")
104 .if defined
(NO_WARRAY_BOUNDS
)
105 _cnowarnflags
+= -Wno-array-bounds
107 .if defined
(NO_STRICT_OVERFLOW
)
108 CFLAGS
+= -fno-strict-overflow
110 .if defined
(NO_STRICT_ALIASING
)
111 CFLAGS
+= -fno-strict-aliasing
115 # Add -Wno-foo flags last
116 .if
!defined
(WARNS_AUDIT
)
117 CWARNFLAGS
+= ${_cnowarnflags}
120 # Allow user-specified additional warning flags
121 CFLAGS
+= ${CWARNFLAGS}
123 # Tell bmake not to mistake standard targets for things to be searched for
124 # or expect to ever be up-to-date
125 PHONY_NOTMAIN
= afterdepend afterinstall
all beforedepend beforeinstall \
126 beforelinking build build-tools buildfiles buildincludes \
127 checkdpadd
clean cleandepend cleandir cleanobj configure \
128 depend dependall
distclean distribute exe extract fetch \
129 html includes
install installfiles installincludes lint \
130 obj objlink objs objwarn patch realall realdepend \
131 realinstall regress subdir-all subdir-depend subdir-install \
134 # if given PROG matches anything in the PHONY list, exclude it.
135 .PHONY
: ${PHONY_NOTMAIN
:N
${PROG
:U
}}
136 .NOTMAIN
: ${PHONY_NOTMAIN}