diff options
author | kris <kris@FreeBSD.org> | 2001-05-19 23:18:21 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2001-05-19 23:18:21 +0000 |
commit | 3252dc5107a4f4a57fac1274dac76f4212b58018 (patch) | |
tree | ddfd198217a004ce1ab17349fb5b0668c701324d /share/mk/bsd.sys.mk | |
parent | a8fdb15db6fec27e9ebc57586662b2c7de9f1406 (diff) | |
download | FreeBSD-src-3252dc5107a4f4a57fac1274dac76f4212b58018.zip FreeBSD-src-3252dc5107a4f4a57fac1274dac76f4212b58018.tar.gz |
Bring in the WARNS directive from NetBSD, localized in a new bsd.sys.mk
to avoid polluting sys.mk. This directive controls the addition of
compiler warning flags to CFLAGS in a relatively compiler-neutral manner.
The idea is that WARNS can be set in Makefile.inc or in individual
Makefiles as they become clean, to prevent the introduction of new
warnings in the code. -Werror is added by default
Diffstat (limited to 'share/mk/bsd.sys.mk')
-rw-r--r-- | share/mk/bsd.sys.mk | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk new file mode 100644 index 0000000..efb69a9 --- /dev/null +++ b/share/mk/bsd.sys.mk @@ -0,0 +1,37 @@ +# $FreeBSD$ +# +# This file contains common settings used for building FreeBSD +# sources. + +# Enable various levels of compiler warning checks. These may be +# overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS. + +.if !defined(NO_WARNS) +. if defined(WARNS) +. if ${WARNS} > 0 +CFLAGS += -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith +# XXX Delete -Wuninitialized by default for now -- the compiler doesn't +# XXX always get it right. +CFLAGS += -Wno-uninitialized +. endif +. if ${WARNS} > 1 +CFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow +. endif +. endif + +. if defined(FORMAT_AUDIT) +WFORMAT = 1 +. endif +. if defined(WFORMAT) +. if ${WFORMAT} > 0 +CFLAGS += -Wnon-const-format -Wno-format-extra-args +. endif +. endif + +. if !defined(NO_WERROR) +CFLAGS += -Werror +. endif +.endif + +# Allow user-specified additional warning flags +CFLAGS += ${CWARNFLAGS} |