2001-11-02 21:34:20 +00:00
|
|
|
# kern.pre.mk
|
|
|
|
#
|
2002-08-14 17:55:11 +00:00
|
|
|
# Unified Makefile for building kernels. This includes all the definitions
|
2001-11-02 21:34:20 +00:00
|
|
|
# that need to be included before %BEFORE_DEPEND
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# Can be overridden by makeoptions or /etc/make.conf
|
|
|
|
KERNEL_KO?= kernel
|
|
|
|
KERNEL?= kernel
|
|
|
|
KODIR?= /boot/${KERNEL}
|
|
|
|
|
|
|
|
M= ${MACHINE_ARCH}
|
|
|
|
|
2002-03-01 01:21:29 +00:00
|
|
|
AWK?= awk
|
2001-11-02 21:34:20 +00:00
|
|
|
NM?= nm
|
|
|
|
OBJCOPY?= objcopy
|
|
|
|
SIZE?= size
|
|
|
|
|
|
|
|
COPTFLAGS?=-O -pipe
|
|
|
|
.if !defined(NO_CPU_COPTFLAGS)
|
|
|
|
COPTFLAGS+= ${_CPUCFLAGS}
|
|
|
|
.endif
|
|
|
|
INCLUDES= -nostdinc -I- ${INCLMAGIC} -I. -I$S -I$S/dev
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2002-07-13 22:28:34 +00:00
|
|
|
COPTS= ${INCLUDES} -D_KERNEL -include opt_global.h
|
2002-01-10 03:52:01 +00:00
|
|
|
CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} -fno-common
|
2001-11-02 21:34:20 +00:00
|
|
|
|
|
|
|
# XXX LOCORE means "don't declare C stuff" not "for locore.s".
|
|
|
|
ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
|
|
|
|
|
2002-07-13 19:36:14 +00:00
|
|
|
.if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
|
2002-07-13 22:28:34 +00:00
|
|
|
CFLAGS+= -DGPROF -falign-functions=16
|
2001-11-02 21:34:20 +00:00
|
|
|
.if ${PROFLEVEL} >= 2
|
2002-07-13 22:28:34 +00:00
|
|
|
CFLAGS+= -DGPROF4 -DGUPROF
|
|
|
|
# XXX -Wno-inline is to break some warnings.
|
|
|
|
PROF= -finstrument-functions -Wno-inline
|
|
|
|
.else
|
|
|
|
PROF= -pg
|
2001-11-02 21:34:20 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
2002-07-13 22:28:34 +00:00
|
|
|
DEFINED_PROF= ${PROF}
|
2002-02-25 22:04:33 +00:00
|
|
|
WERROR?= -Werror
|
2002-02-20 23:35:56 +00:00
|
|
|
|
2001-11-02 21:34:20 +00:00
|
|
|
# Put configuration-specific C flags last (except for ${PROF}) so that they
|
|
|
|
# can override the others.
|
|
|
|
CFLAGS+= ${CONF_CFLAGS}
|
|
|
|
|
2002-02-20 23:35:56 +00:00
|
|
|
NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
|
|
|
|
NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
|
|
|
|
PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC}
|
2002-10-19 22:24:43 +00:00
|
|
|
NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
|
2001-11-02 21:34:20 +00:00
|
|
|
|
2002-10-19 16:47:13 +00:00
|
|
|
NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \
|
|
|
|
${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c
|
2001-11-02 21:34:20 +00:00
|
|
|
|
|
|
|
GEN_CFILES= $S/$M/$M/genassym.c
|
|
|
|
SYSTEM_CFILES= vnode_if.c hints.c env.c config.c
|
|
|
|
SYSTEM_SFILES= $S/$M/$M/locore.s
|
|
|
|
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
|
|
|
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So
|
2003-02-27 08:52:11 +00:00
|
|
|
SYSTEM_OBJS+= majors.o
|
2001-11-02 21:34:20 +00:00
|
|
|
SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
|
2002-01-10 03:52:01 +00:00
|
|
|
-warn-common -export-dynamic -dynamic-linker /red/herring \
|
2001-11-02 21:34:20 +00:00
|
|
|
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
|
|
|
|
SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
|
|
|
|
${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET}
|
|
|
|
SYSTEM_DEP+= $S/conf/ldscript.$M
|
|
|
|
|
2002-01-05 06:21:06 +00:00
|
|
|
# MKMODULESENV is set here so that port makefiles can augment
|
|
|
|
# them.
|
|
|
|
|
|
|
|
MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
|
2002-02-17 21:00:20 +00:00
|
|
|
.if (${KERN_IDENT} == LINT)
|
|
|
|
MKMODULESENV+= ALL_MODULES=LINT
|
|
|
|
.endif
|
2002-01-05 06:21:06 +00:00
|
|
|
.if defined(MODULES_OVERRIDE)
|
|
|
|
MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
|
|
|
|
.endif
|
|
|
|
.if defined(DEBUG)
|
|
|
|
MKMODULESENV+= DEBUG="${DEBUG}" DEBUG_FLAGS="${DEBUG}"
|
|
|
|
.endif
|