kern.pre.mk revision 99932
185909Simp# kern.pre.mk 285909Simp# 385909Simp# Unified Makefile for building kenrels. This includes all the definitions 485909Simp# that need to be included before %BEFORE_DEPEND 585909Simp# 685909Simp# $FreeBSD: head/sys/conf/kern.pre.mk 99932 2002-07-13 22:28:34Z bde $ 785909Simp# 885909Simp 985909Simp# Can be overridden by makeoptions or /etc/make.conf 1085909SimpKERNEL_KO?= kernel 1185909SimpKERNEL?= kernel 1285909SimpKODIR?= /boot/${KERNEL} 1385909Simp 1485909SimpM= ${MACHINE_ARCH} 1585909Simp 1691512SobrienAWK?= awk 1785909SimpNM?= nm 1885909SimpOBJCOPY?= objcopy 1985909SimpSIZE?= size 2085909Simp 2185909SimpCOPTFLAGS?=-O -pipe 2285909Simp.if !defined(NO_CPU_COPTFLAGS) 2385909SimpCOPTFLAGS+= ${_CPUCFLAGS} 2485909Simp.endif 2585909SimpINCLUDES= -nostdinc -I- ${INCLMAGIC} -I. -I$S -I$S/dev 2685909Simp 2785909Simp# This hack lets us use the Intel ACPICA code without spamming a new 2885909Simp# include path into 100+ source files. 2985909SimpINCLUDES+= -I$S/contrib/dev/acpica 3085909Simp 3185909Simp# ... and the same for ipfilter 3285909SimpINCLUDES+= -I$S/contrib/ipfilter 3385909Simp 3485909Simp# This hack is to allow kernel compiles to succeed on machines w/out srcdist 3585909Simp.if exists($S/../include) 3685909SimpINCLUDES+= -I$S/../include 3785909Simp.else 3885909SimpINCLUDES+= -I/usr/include 3985909Simp.endif 4085909Simp 4199932SbdeCOPTS= ${INCLUDES} -D_KERNEL -include opt_global.h 4289180SmsmithCFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} -fno-common 4385909Simp 4485909Simp# XXX LOCORE means "don't declare C stuff" not "for locore.s". 4585909SimpASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} 4685909Simp 4785909Simp# Select the correct set of tools. Can't set OBJFORMAT here because it 4885909Simp# doesn't get exported into the environment, and if it were exported 4985909Simp# then it might break building of utilities. 5085909SimpCFLAGS+= ${FMT} 5185909Simp 5299923Sbde.if defined(PROFLEVEL) && ${PROFLEVEL} >= 1 5399932SbdeCFLAGS+= -DGPROF -falign-functions=16 5499932Sbde.if ${PROFLEVEL} >= 2 5599932SbdeCFLAGS+= -DGPROF4 -DGUPROF 5699932Sbde# XXX -Wno-inline is to break some warnings. 5799932SbdePROF= -finstrument-functions -Wno-inline 5899932Sbde.else 5999923SbdePROF= -pg 6099923Sbde.endif 6199932Sbde.endif 6285909SimpDEFINED_PROF= ${PROF} 6385909Simp 6491255Speter.if defined(NO_WERROR) 6591255SpeterWERROR= 6691255Speter.else 6791255SpeterWERROR?= -Werror 6891255Speter.endif 6991002Speter 7085909Simp# Put configuration-specific C flags last (except for ${PROF}) so that they 7185909Simp# can override the others. 7285909SimpCFLAGS+= ${CONF_CFLAGS} 7385909Simp 7491002SpeterNORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} 7591002SpeterNORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC} 7691002SpeterPROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC} 7791002SpeterNORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 7885909Simp 7995844SobrienNORMAL_M= ${AWK} -f $S/tools/makeobjops.awk $< -c ; \ 8085909Simp ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c 8185909Simp 8285909SimpGEN_CFILES= $S/$M/$M/genassym.c 8385909SimpSYSTEM_CFILES= vnode_if.c hints.c env.c config.c 8485909SimpSYSTEM_SFILES= $S/$M/$M/locore.s 8585909SimpSYSTEM_DEP= Makefile ${SYSTEM_OBJS} 8685909SimpSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So 8785909SimpSYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \ 8889180Smsmith -warn-common -export-dynamic -dynamic-linker /red/herring \ 8985909Simp -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 9085909SimpSYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \ 9185909Simp ${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET} 9285909SimpSYSTEM_DEP+= $S/conf/ldscript.$M 9385909Simp 9488893Simp# MKMODULESENV is set here so that port makefiles can augment 9588893Simp# them. 9688893Simp 9788893SimpMKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR} 9890789Sphk.if (${KERN_IDENT} == LINT) 9990789SphkMKMODULESENV+= ALL_MODULES=LINT 10090789Sphk.endif 10188893Simp.if defined(MODULES_OVERRIDE) 10288893SimpMKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}" 10388893Simp.endif 10488893Simp.if defined(DEBUG) 10588893SimpMKMODULESENV+= DEBUG="${DEBUG}" DEBUG_FLAGS="${DEBUG}" 10688893Simp.endif 10788893Simp 10886253Simpall: ${KERNEL_KO} 109