xref: /dragonfly/share/mk/bsd.sys.mk (revision 984263bc)
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 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.if !defined(NO_WARNS)
10. if defined(WARNS)
11.  if ${WARNS} > 0
12CFLAGS		+=	-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
13# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
14# XXX always get it right.
15CFLAGS		+=	-Wno-uninitialized
16.   if defined(WARNS_WERROR) && !defined(NO_WERROR)
17CFLAGS		+=	-Werror
18.   endif
19.  endif
20.  if ${WARNS} > 1
21CFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow
22.  endif
23. endif
24
25. if defined(FORMAT_AUDIT)
26WFORMAT		=	1
27. endif
28. if defined(WFORMAT)
29.  if ${WFORMAT} > 0
30CFLAGS		+=	-Wnon-const-format -Wno-format-extra-args
31.   if defined(WARNS_WERROR) && !defined(NO_WERROR)
32CFLAGS		+=	-Werror
33.   endif
34.  endif
35. endif
36.endif
37
38# Allow user-specified additional warning flags
39CFLAGS		+=	${CWARNFLAGS}
40
41# FreeBSD prior to 4.5 didn't have the __FBSDID() macro in <sys/cdefs.h>.
42.if defined(BOOTSTRAPPING)
43CFLAGS+=	-D__FBSDID=__RCSID
44.endif
45