summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/mk/bsd.cpu.mk20
-rw-r--r--share/mk/bsd.dep.mk19
-rw-r--r--share/mk/bsd.lib.mk15
-rw-r--r--share/mk/bsd.sys.mk2
-rw-r--r--sys/conf/files4
-rw-r--r--sys/conf/kern.mk15
-rw-r--r--sys/conf/kern.pre.mk33
-rw-r--r--sys/conf/kmod.mk15
-rw-r--r--sys/dev/aic7xxx/aicasm/Makefile9
9 files changed, 113 insertions, 19 deletions
diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk
index 94c1020..1c24577 100644
--- a/share/mk/bsd.cpu.mk
+++ b/share/mk/bsd.cpu.mk
@@ -44,26 +44,38 @@ CPUTYPE = athlon
. if ${MACHINE_ARCH} == "i386"
. if ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \
- ${CPUTYPE} == "athlon-4" || ${CPUTYPE} == "athlon-tbird" || \
- ${CPUTYPE} == "athlon"
+ ${CPUTYPE} == "athlon-4" || ${CPUTYPE} == "athlon-tbird"
+_ICC_CPUCFLAGS = -tpp6 -xiMK
_CPUCFLAGS = -march=${CPUTYPE}
+. elif ${CPUTYPE} == "athlon-tbird" || ${CPUTYPE} == "athlon"
+_CPUCFLAGS = -march=${CPUTYPE}
+_ICC_CPUCFLAGS = -tpp6 -xiM
. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" || ${CPUTYPE} == "k6"
_CPUCFLAGS = -march=${CPUTYPE}
+_ICC_CPUCFLAGS = -tpp6 -xi
. elif ${CPUTYPE} == "k5"
+_ICC_CPUCFLAGS = -tpp5
_CPUCFLAGS = -march=pentium
. elif ${CPUTYPE} == "p4"
+_ICC_CPUCFLAGS = -tpp7 -xiMKW
_CPUCFLAGS = -march=pentium4
. elif ${CPUTYPE} == "p3"
+_ICC_CPUCFLAGS = -tpp6 -xiMK
_CPUCFLAGS = -march=pentium3
. elif ${CPUTYPE} == "p2"
+_ICC_CPUCFLAGS = -tpp6 -xiM
_CPUCFLAGS = -march=pentium2
. elif ${CPUTYPE} == "i686"
+_ICC_CPUCFLAGS = -tpp6 -xiM
_CPUCFLAGS = -march=pentiumpro
. elif ${CPUTYPE} == "i586/mmx"
+_ICC_CPUCFLAGS = -tpp5 -xM
_CPUCFLAGS = -march=pentium-mmx
. elif ${CPUTYPE} == "i586"
+_ICC_CPUCFLAGS = -tpp5
_CPUCFLAGS = -march=pentium
. elif ${CPUTYPE} == "i486"
+_ICC_CPUCFLAGS =
_CPUCFLAGS = -march=i486
. endif
. elif ${MACHINE_ARCH} == "alpha"
@@ -147,5 +159,9 @@ _CPUCFLAGS += -mieee
# NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk
.if !defined(NO_CPU_CFLAGS)
+. if ${CC} == "icc"
+CFLAGS += ${_ICC_CPUCFLAGS}
+. else
CFLAGS += ${_CPUCFLAGS}
+. endif
.endif
diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk
index a76455a..1b51834 100644
--- a/share/mk/bsd.dep.mk
+++ b/share/mk/bsd.dep.mk
@@ -125,25 +125,32 @@ depend: beforedepend ${DEPENDFILE} afterdepend
# Different types of sources are compiled with slightly different flags.
# Split up the sources, and filter out headers and non-applicable flags.
+.if ${CC} == "icc"
+MKDEP_CFLAGS= ${CFLAGS:M-X*} ${CFLAGS:M-[BID]*}
+MKDEP_CXXFLAGS= ${CXXFLAGS:M-X*} ${CXXFLAGS:M-[BID]*}
+MKDEP_OBJCFLAGS=${OBJCFLAGS:M-X*} ${OBJCFLAGS:M-[BID]*}
+.else
+MKDEP_CFLAGS= ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*}
+MKDEP_CXXFLAGS= ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*}
+MKDEP_OBJCFLAGS=${OBJCFLAGS:M-nostdinc*} ${OBJCFLAGS:M-[BID]*} ${OBJCFLAGS:M-Wno-import*}
+.endif
+
DPSRCS+= ${SRCS}
${DEPENDFILE}: ${DPSRCS}
rm -f ${DEPENDFILE}
.if !empty(DPSRCS:M*.[cS])
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
- ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*} \
- ${.ALLSRC:M*.[cS]}
+ ${MKDEP_CFLAGS} ${.ALLSRC:M*.[cS]}
.endif
.if !empty(DPSRCS:M*.cc) || !empty(DPSRCS:M*.C) || !empty(DPSRCS:M*.cpp) || \
!empty(DPSRCS:M*.cxx)
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
- ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*} \
+ ${MKDEP_CXXFLAGS} \
${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cpp} ${.ALLSRC:M*.cxx}
.endif
.if !empty(DPSRCS:M*.m)
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
- ${OBJCFLAGS:M-nostdinc*} ${OBJCFLAGS:M-[BID]*} \
- ${OBJCFLAGS:M-Wno-import*} \
- ${.ALLSRC:M*.m}
+ ${MKDEP_OBJCFLAGS} ${.ALLSRC:M*.m}
.endif
.if target(_EXTRADEPEND)
_EXTRADEPEND: .USE
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 7a9b9ad..efa898d 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -48,14 +48,23 @@ PICFLAG=-fpic
.endif
.endif
+.if ${CC} == "icc"
+PO_FLAG=-p
+.else
+PO_FLAG=-pg
+.endif
+
+.c.o:
+ ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+
.c.po:
- ${CC} -pg ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+ ${CC} ${PO_FLAG} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.c.So:
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.cc.po .C.po .cpp.po .cxx.po:
- ${CXX} -pg ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+ ${CXX} ${PO_FLAG} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.cc.So .C.So .cpp.So .cxx.So:
${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@@ -157,7 +166,7 @@ ${LINTLIB}: ${LINTOBJS}
${LINT} ${LINTLIBFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
.endif
-.endif !defined(INTERNALLIB)
+.endif #!defined(INTERNALLIB)
all: ${_LIBS}
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 587bc84..3821801 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -8,7 +8,7 @@
# for GCC: http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143
-.if !defined(NO_WARNS)
+.if !defined(NO_WARNS) && ${CC} != "icc"
. if defined(WARNS)
. if ${WARNS} > 0
CWARNFLAGS += -Wsystem-headers
diff --git a/sys/conf/files b/sys/conf/files
index 73d1df7..339f7db 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -6,12 +6,12 @@
#
aicasm optional ahc \
dependency "$S/dev/aic7xxx/aicasm/*.[chyl]" \
- compile-with "${MAKE} -f $S/dev/aic7xxx/aicasm/Makefile MAKESRCPATH=$S/dev/aic7xxx/aicasm" \
+ compile-with "CC=${CC} ${MAKE} -f $S/dev/aic7xxx/aicasm/Makefile MAKESRCPATH=$S/dev/aic7xxx/aicasm" \
no-obj no-implicit-rule \
clean "aicasm* y.tab.h"
aicasm optional ahd \
dependency "$S/dev/aic7xxx/aicasm/*.[chyl]" \
- compile-with "${MAKE} -f $S/dev/aic7xxx/aicasm/Makefile MAKESRCPATH=$S/dev/aic7xxx/aicasm" \
+ compile-with "CC=${CC} ${MAKE} -f $S/dev/aic7xxx/aicasm/Makefile MAKESRCPATH=$S/dev/aic7xxx/aicasm" \
no-obj no-implicit-rule \
clean "aicasm* y.tab.h"
aic7xxx_{seq.h,reg.h,reg_print.c} optional ahc \
diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
index dc369df..133f1cf 100644
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -6,9 +6,14 @@
# Note that the newly added -Wcast-qual is responsible for generating
# most of the remaining warnings. Warnings introduced with -Wall will
# also pop up, but are easier to fix.
+.if ${CC} == "icc"
+#CWARNFLAGS= -w2 # use this if you are terribly bored
+CWARNFLAGS=
+.else
CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
-fformat-extensions -std=c99
+.endif
#
# The following flags are next up for working on:
# -W
@@ -22,7 +27,7 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
# use of code cache tag lines) and uses more stack (less efficient use of data
# cache tag lines)
#
-.if ${MACHINE_ARCH} == "i386"
+.if ${MACHINE_ARCH} == "i386" && ${CC} != "icc"
CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2
INLINE_LIMIT?= 8000
.endif
@@ -80,4 +85,12 @@ INLINE_LIMIT?= 15000
# GCC 3.0 and above like to do certain optimizations based on the
# assumption that the program is linked against libc. Stop this.
#
+.if ${CC} == "icc"
+CFLAGS+= -nolib_inline
+.else
CFLAGS+= -ffreestanding
+.endif
+
+.if ${CC} == "icc"
+CFLAGS+= -restrict
+.endif
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index 9732ffb..4a786a5 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -16,14 +16,28 @@ NM?= nm
OBJCOPY?= objcopy
SIZE?= size
+.if ${CC} == "icc"
+COPTFLAGS?=-O
+.else
COPTFLAGS?=-O -pipe
-.if ${COPTFLAGS:M-O[23s]} != ""
+. if ${COPTFLAGS:M-O[23s]} != ""
COPTFLAGS+= -fno-strict-aliasing
+. endif
.endif
.if !defined(NO_CPU_COPTFLAGS)
+. if ${CC} == "icc"
+COPTFLAGS+= ${_ICC_CPUCFLAGS:C/(-x[^M^K^W]+)[MKW]+|-x[MKW]+/\1/}
+. else
COPTFLAGS+= ${_CPUCFLAGS}
+. endif
+.endif
+.if ${CC} == "icc"
+NOSTDINC= -X
+.else
+NOSTDINC= -nostdinc
.endif
-INCLUDES= -nostdinc -I- ${INCLMAGIC} -I. -I$S
+
+INCLUDES= ${NOSTDINC} -I- ${INCLMAGIC} -I. -I$S
# This hack lets us use the Intel ACPICA code without spamming a new
# include path into 100+ source files.
@@ -43,19 +57,34 @@ INCLUDES+= -I$S/contrib/ngatm
COPTS= ${INCLUDES} -D_KERNEL -include opt_global.h
CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
+.if ${CC} != "icc"
CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT}
WERROR?= -Werror
+.endif
# XXX LOCORE means "don't declare C stuff" not "for locore.s".
ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
.if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
+. if ${CC} == "icc"
+CFLAGS+= -DGPROF
+. else
CFLAGS+= -DGPROF -falign-functions=16
+. endif
.if ${PROFLEVEL} >= 2
CFLAGS+= -DGPROF4 -DGUPROF
+. if ${CC} == "icc"
+# XXX doesn't work yet
+#PROF= -prof_gen
+. else
PROF= -finstrument-functions
+. endif
.else
+. if ${CC} == "icc"
+PROF= -p
+. else
PROF= -pg
+. endif
.endif
.endif
DEFINED_PROF= ${PROF}
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index 0766b71..c303061 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -70,6 +70,10 @@ OBJCOPY?= objcopy
.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
+.if ${CC} == "icc"
+_ICC_CFLAGS:= ${CFLAGS:C/(-x[^M^K^W]+)[MKW]+|-x[MKW]+/\1/}
+CFLAGS= ${_ICC_CFLAGS}
+.endif
CFLAGS+= ${COPTS} -D_KERNEL
CFLAGS+= -DKLD_MODULE
@@ -78,7 +82,12 @@ CFLAGS+= -DKLD_MODULE
# such paths after -nostdinc. It doesn't seem to be possible to
# add to the front of `make' variable.
_ICFLAGS:= ${CFLAGS:M-I*}
-CFLAGS+= -nostdinc -I- ${INCLMAGIC} ${_ICFLAGS}
+.if ${CC} == "icc"
+NOSTDINC= -X
+.else
+NOSTDINC= -nostdinc
+.endif
+CFLAGS+= ${NOSTDINC} -I- ${INCLMAGIC} ${_ICFLAGS}
.if defined(KERNBUILDDIR)
CFLAGS+= -include ${KERNBUILDDIR}/opt_global.h
.endif
@@ -102,11 +111,15 @@ CFLAGS+= -I${DESTDIR}/usr/include
CFLAGS+= -I@/../include -I${DESTDIR}/usr/include
.endif # @
+.if ${CC} != "icc"
CFLAGS+= -finline-limit=${INLINE_LIMIT}
+.endif
# Disallow common variables, and if we end up with commons from
# somewhere unexpected, allocate storage for them in the module itself.
+.if ${CC} != "icc"
CFLAGS+= -fno-common
+.endif
LDFLAGS+= -d -warn-common
CFLAGS+= ${DEBUG_FLAGS}
diff --git a/sys/dev/aic7xxx/aicasm/Makefile b/sys/dev/aic7xxx/aicasm/Makefile
index b078a4c..fa35af3 100644
--- a/sys/dev/aic7xxx/aicasm/Makefile
+++ b/sys/dev/aic7xxx/aicasm/Makefile
@@ -1,3 +1,4 @@
+#
# $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aicasm/Makefile#2 $
#
# $FreeBSD$
@@ -22,7 +23,13 @@ LDADD= -ll
DEPENDFILE=
.endif
-CFLAGS+= -nostdinc -I/usr/include -I.
+.if ${CC} == "icc"
+CFLAGS+= -restrict
+NOSTDINC= -X
+.else
+NOSTDINC= -nostdinc
+.endif
+CFLAGS+= ${NOSTDINC} -I/usr/include -I.
.ifdef MAKESRCPATH
CFLAGS+= -I${MAKESRCPATH}
.endif
OpenPOWER on IntegriCloud