06d6e4fcfe
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
135 lines
3.3 KiB
Makefile
135 lines
3.3 KiB
Makefile
# $FreeBSD$
|
|
|
|
# Part of a unified Makefile for building kernels. This part contains all
|
|
# of the definitions that need to be before %BEFORE_DEPEND.
|
|
|
|
# Can be overridden by makeoptions or /etc/make.conf
|
|
KERNEL_KO?= kernel
|
|
KERNEL?= kernel
|
|
KODIR?= /boot/${KERNEL}
|
|
|
|
M= ${MACHINE_ARCH}
|
|
|
|
AWK?= awk
|
|
LINT?= lint
|
|
NM?= nm
|
|
OBJCOPY?= objcopy
|
|
SIZE?= size
|
|
|
|
.if ${CC} == "icc"
|
|
COPTFLAGS?=-O
|
|
.else
|
|
COPTFLAGS?=-O -pipe
|
|
. 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
|
|
|
|
# This hack lets us use the Intel ACPICA code without spamming a new
|
|
# include path into 100+ source files.
|
|
INCLUDES+= -I$S/contrib/dev/acpica
|
|
|
|
# ... and the same for ipfilter
|
|
INCLUDES+= -I$S/contrib/ipfilter
|
|
|
|
# ... and the same for pf
|
|
INCLUDES+= -I$S/contrib/pf
|
|
|
|
# ... and the same for Atheros HAL
|
|
INCLUDES+= -I$S/contrib/dev/ath -I$S/contrib/dev/ath/freebsd
|
|
|
|
# ... and the same for the NgATM stuff
|
|
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}
|
|
|
|
# Put configuration-specific C flags last (except for ${PROF}) so that they
|
|
# can override the others.
|
|
CFLAGS+= ${CONF_CFLAGS}
|
|
|
|
# Optional linting. This can be overridden in /etc/make.conf.
|
|
LINTFLAGS= ${LINTOBJKERNFLAGS}
|
|
|
|
NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
|
|
NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
|
|
PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC}
|
|
NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
|
|
|
|
NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \
|
|
${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c
|
|
|
|
NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC}
|
|
|
|
GEN_CFILES= $S/$M/$M/genassym.c
|
|
SYSTEM_CFILES= config.c env.c hints.c majors.c vnode_if.c
|
|
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
|
SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS}
|
|
SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o}
|
|
SYSTEM_OBJS+= hack.So
|
|
SYSTEM_LD= @${LD} -Bdynamic -T $S/conf/ldscript.$M \
|
|
-warn-common -export-dynamic -dynamic-linker /red/herring \
|
|
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
|
|
SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
|
|
${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}
|
|
SYSTEM_DEP+= $S/conf/ldscript.$M
|
|
|
|
# MKMODULESENV is set here so that port makefiles can augment
|
|
# them.
|
|
|
|
MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
|
|
.if (${KERN_IDENT} == LINT)
|
|
MKMODULESENV+= ALL_MODULES=LINT
|
|
.endif
|
|
.if defined(MODULES_OVERRIDE)
|
|
MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
|
|
.endif
|
|
.if defined(DEBUG)
|
|
MKMODULESENV+= DEBUG_FLAGS="${DEBUG}"
|
|
.endif
|