kern.pre.mk revision 99923
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 99923 2002-07-13 19:36:14Z 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 4198295SmuxCOPTS= ${INCLUDES} ${IDENT} -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 5399923SbdeIDENT= -DGPROF 5499923SbdePROF= -pg 5599923Sbde.endif 5699923Sbde 5785909SimpDEFINED_PROF= ${PROF} 5885909Simp.if defined(PROF) 5996461SbdeCFLAGS+= -falign-functions=16 6085909Simp.if ${PROFLEVEL} >= 2 6185909SimpIDENT+= -DGPROF4 -DGUPROF 6285909SimpPROF+= -mprofiler-epilogue 6385909Simp.endif 6485909Simp.endif 6585909Simp 6691255Speter.if defined(NO_WERROR) 6791255SpeterWERROR= 6891255Speter.else 6991255SpeterWERROR?= -Werror 7091255Speter.endif 7191002Speter 7285909Simp# Put configuration-specific C flags last (except for ${PROF}) so that they 7385909Simp# can override the others. 7485909SimpCFLAGS+= ${CONF_CFLAGS} 7585909Simp 7691002SpeterNORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} 7791002SpeterNORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC} 7891002SpeterPROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC} 7991002SpeterNORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 8085909Simp 8195844SobrienNORMAL_M= ${AWK} -f $S/tools/makeobjops.awk $< -c ; \ 8285909Simp ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c 8385909Simp 8485909SimpGEN_CFILES= $S/$M/$M/genassym.c 8585909SimpSYSTEM_CFILES= vnode_if.c hints.c env.c config.c 8685909SimpSYSTEM_SFILES= $S/$M/$M/locore.s 8785909SimpSYSTEM_DEP= Makefile ${SYSTEM_OBJS} 8885909SimpSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So 8985909SimpSYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \ 9089180Smsmith -warn-common -export-dynamic -dynamic-linker /red/herring \ 9185909Simp -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 9285909SimpSYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \ 9385909Simp ${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET} 9485909SimpSYSTEM_DEP+= $S/conf/ldscript.$M 9585909Simp 9688893Simp# MKMODULESENV is set here so that port makefiles can augment 9788893Simp# them. 9888893Simp 9988893SimpMKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR} 10090789Sphk.if (${KERN_IDENT} == LINT) 10190789SphkMKMODULESENV+= ALL_MODULES=LINT 10290789Sphk.endif 10388893Simp.if defined(MODULES_OVERRIDE) 10488893SimpMKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}" 10588893Simp.endif 10688893Simp.if defined(DEBUG) 10788893SimpMKMODULESENV+= DEBUG="${DEBUG}" DEBUG_FLAGS="${DEBUG}" 10888893Simp.endif 10988893Simp 11086253Simpall: ${KERNEL_KO} 111