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
This commit is contained in:
parent
a514569e9a
commit
d510ecb42b
@ -5,7 +5,7 @@ FILES= bsd.README
|
||||
FILES+= bsd.cpu.mk bsd.dep.mk bsd.doc.mk bsd.docb.mk bsd.info.mk bsd.kern.mk bsd.kmod.mk
|
||||
FILES+= bsd.lib.mk bsd.libnames.mk bsd.man.mk bsd.obj.mk bsd.own.mk
|
||||
FILES+= bsd.port.mk bsd.port.post.mk bsd.port.pre.mk bsd.port.subdir.mk
|
||||
FILES+= bsd.prog.mk bsd.sgml.mk bsd.subdir.mk
|
||||
FILES+= bsd.prog.mk bsd.sgml.mk bsd.subdir.mk bsd.sys.mk
|
||||
FILES+= sys.mk
|
||||
NOOBJ= noobj
|
||||
|
||||
|
@ -11,3 +11,5 @@ SYSDIR= ${_dir}
|
||||
.endif
|
||||
|
||||
.include "${SYSDIR}/conf/kmod.mk"
|
||||
|
||||
.include <bsd.sys.mk>
|
||||
|
@ -375,3 +375,5 @@ ${OBJS} ${STATICOBJS} ${POBJS} ${SOBJS}: ${SRCS:M*.h}
|
||||
.endif
|
||||
|
||||
.include <bsd.obj.mk>
|
||||
|
||||
.include <bsd.sys.mk>
|
||||
|
@ -222,3 +222,5 @@ ${OBJS}: ${SRCS:M*.h}
|
||||
.endif
|
||||
|
||||
.include <bsd.obj.mk>
|
||||
|
||||
.include <bsd.sys.mk>
|
||||
|
37
share/mk/bsd.sys.mk
Normal file
37
share/mk/bsd.sys.mk
Normal file
@ -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}
|
Loading…
Reference in New Issue
Block a user