2001-05-19 23:18:21 +00:00
|
|
|
# $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.
|
|
|
|
|
2002-05-10 01:58:16 +00:00
|
|
|
# for GCC: http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143
|
|
|
|
|
2007-05-19 04:41:05 +00:00
|
|
|
# Universally disable -Werror until src/ is in better shape for GCC 4.2
|
|
|
|
NO_WERROR=
|
|
|
|
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
.if !defined(NO_WARNS) && ${CC} != "icc"
|
2006-08-11 17:28:59 +00:00
|
|
|
. if defined(CSTD)
|
|
|
|
. if ${CSTD} == "k&r"
|
|
|
|
CFLAGS += -traditional
|
|
|
|
. elif ${CSTD} == "c89" || ${CSTD} == "c90"
|
|
|
|
CFLAGS += -std=iso9899:1990
|
|
|
|
. elif ${CSTD} == "c94" || ${CSTD} == "c95"
|
|
|
|
CFLAGS += -std=iso9899:199409
|
|
|
|
. elif ${CSTD} == "c99"
|
|
|
|
CFLAGS += -std=iso9899:1999
|
|
|
|
. else
|
|
|
|
CFLAGS += -std=${CSTD}
|
|
|
|
. endif
|
|
|
|
# -pedantic is problematic because it also imposes namespace restrictions
|
|
|
|
#CFLAGS += -pedantic
|
|
|
|
. endif
|
2001-05-19 23:18:21 +00:00
|
|
|
. if defined(WARNS)
|
2005-01-16 21:08:31 +00:00
|
|
|
. if ${WARNS} >= 1
|
2004-01-11 10:29:55 +00:00
|
|
|
CWARNFLAGS += -Wsystem-headers
|
2002-07-07 18:47:52 +00:00
|
|
|
. if !defined(NO_WERROR)
|
2004-01-11 10:29:55 +00:00
|
|
|
CWARNFLAGS += -Werror
|
2002-07-07 18:47:52 +00:00
|
|
|
. endif
|
2001-05-19 23:18:21 +00:00
|
|
|
. endif
|
2005-01-16 21:08:31 +00:00
|
|
|
. if ${WARNS} >= 2
|
2004-01-11 10:29:55 +00:00
|
|
|
CWARNFLAGS += -Wall -Wno-format-y2k
|
2001-12-15 06:02:15 +00:00
|
|
|
. endif
|
2005-01-16 21:08:31 +00:00
|
|
|
. if ${WARNS} >= 3
|
2005-01-16 21:18:16 +00:00
|
|
|
CWARNFLAGS += -W -Wno-unused-parameter -Wstrict-prototypes\
|
|
|
|
-Wmissing-prototypes -Wpointer-arith
|
2001-12-15 06:02:15 +00:00
|
|
|
. endif
|
2005-01-16 21:08:31 +00:00
|
|
|
. if ${WARNS} >= 4
|
2005-01-16 21:18:16 +00:00
|
|
|
CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
|
|
|
|
-Wshadow -Wcast-align -Wunused-parameter
|
2001-05-19 23:18:21 +00:00
|
|
|
. endif
|
2002-04-10 02:45:22 +00:00
|
|
|
# BDECFLAGS
|
2005-01-16 21:08:31 +00:00
|
|
|
. if ${WARNS} >= 6
|
2004-02-16 20:07:06 +00:00
|
|
|
CWARNFLAGS += -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
|
2002-04-10 02:45:22 +00:00
|
|
|
. endif
|
2005-01-16 21:08:31 +00:00
|
|
|
. if ${WARNS} >= 2 && ${WARNS} <= 4
|
2002-01-05 20:17:50 +00:00
|
|
|
# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
|
|
|
|
# XXX always get it right.
|
2004-01-11 10:29:55 +00:00
|
|
|
CWARNFLAGS += -Wno-uninitialized
|
2002-01-05 20:17:50 +00:00
|
|
|
. endif
|
2007-05-24 21:53:42 +00:00
|
|
|
. if !defined(WITH_GCC3)
|
2007-05-19 04:41:05 +00:00
|
|
|
CWARNFLAGS += -Wno-pointer-sign
|
2007-05-24 21:53:42 +00:00
|
|
|
. endif
|
2001-05-19 23:18:21 +00:00
|
|
|
. endif
|
|
|
|
|
|
|
|
. if defined(FORMAT_AUDIT)
|
|
|
|
WFORMAT = 1
|
|
|
|
. endif
|
|
|
|
. if defined(WFORMAT)
|
|
|
|
. if ${WFORMAT} > 0
|
2004-01-11 10:29:55 +00:00
|
|
|
#CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
|
|
|
|
CWARNFLAGS += -Wformat=2 -Wno-format-extra-args
|
2002-07-07 18:47:52 +00:00
|
|
|
. if !defined(NO_WERROR)
|
2004-01-11 10:29:55 +00:00
|
|
|
CWARNFLAGS += -Werror
|
2002-07-07 18:47:52 +00:00
|
|
|
. endif
|
2001-05-19 23:32:19 +00:00
|
|
|
. endif
|
2001-05-19 23:18:21 +00:00
|
|
|
. endif
|
|
|
|
.endif
|
|
|
|
|
2006-11-04 04:39:05 +00:00
|
|
|
.if defined(IGNORE_PRAGMA)
|
|
|
|
CWARNFLAGS += -Wno-unknown-pragmas
|
|
|
|
.endif
|
|
|
|
|
2001-05-19 23:18:21 +00:00
|
|
|
# Allow user-specified additional warning flags
|
|
|
|
CFLAGS += ${CWARNFLAGS}
|