kern.pre.mk revision 88893
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 88893 2002-01-05 06:21:06Z imp $ 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 1685909SimpNM?= nm 1785909SimpOBJCOPY?= objcopy 1885909SimpSIZE?= size 1985909Simp 2085909SimpCOPTFLAGS?=-O -pipe 2185909Simp.if !defined(NO_CPU_COPTFLAGS) 2285909SimpCOPTFLAGS+= ${_CPUCFLAGS} 2385909Simp.endif 2485909SimpINCLUDES= -nostdinc -I- ${INCLMAGIC} -I. -I$S -I$S/dev 2585909Simp 2685909Simp# This hack lets us use the Intel ACPICA code without spamming a new 2785909Simp# include path into 100+ source files. 2885909SimpINCLUDES+= -I$S/contrib/dev/acpica 2985909Simp 3085909Simp# ... and the same for ipfilter 3185909SimpINCLUDES+= -I$S/contrib/ipfilter 3285909Simp 3385909Simp# This hack is to allow kernel compiles to succeed on machines w/out srcdist 3485909Simp.if exists($S/../include) 3585909SimpINCLUDES+= -I$S/../include 3685909Simp.else 3785909SimpINCLUDES+= -I/usr/include 3885909Simp.endif 3985909Simp 4087451SobrienCOPTS= ${INCLUDES} ${IDENT} -D_KERNEL -ffreestanding -include opt_global.h 4185909SimpCFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 4285909Simp 4385909Simp# XXX LOCORE means "don't declare C stuff" not "for locore.s". 4485909SimpASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} 4585909Simp 4685909Simp# Select the correct set of tools. Can't set OBJFORMAT here because it 4785909Simp# doesn't get exported into the environment, and if it were exported 4885909Simp# then it might break building of utilities. 4985909SimpFMT?= -elf 5085909SimpCFLAGS+= ${FMT} 5185909Simp 5285909SimpDEFINED_PROF= ${PROF} 5385909Simp.if defined(PROF) 5485909SimpCFLAGS+= -malign-functions=4 5585909Simp.if ${PROFLEVEL} >= 2 5685909SimpIDENT+= -DGPROF4 -DGUPROF 5785909SimpPROF+= -mprofiler-epilogue 5885909Simp.endif 5985909Simp.endif 6085909Simp 6185909Simp# Put configuration-specific C flags last (except for ${PROF}) so that they 6285909Simp# can override the others. 6385909SimpCFLAGS+= ${CONF_CFLAGS} 6485909Simp 6585909SimpNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 6685909SimpNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 6785909SimpNORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC} 6885909SimpPROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC} 6985909Simp 7085909SimpNORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \ 7185909Simp ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c 7285909Simp 7385909SimpGEN_CFILES= $S/$M/$M/genassym.c 7485909SimpSYSTEM_CFILES= vnode_if.c hints.c env.c config.c 7585909SimpSYSTEM_SFILES= $S/$M/$M/locore.s 7685909SimpSYSTEM_DEP= Makefile ${SYSTEM_OBJS} 7785909SimpSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So 7885909SimpSYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \ 7985909Simp -export-dynamic -dynamic-linker /red/herring \ 8085909Simp -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 8185909SimpSYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \ 8285909Simp ${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET} 8385909SimpSYSTEM_DEP+= $S/conf/ldscript.$M 8485909Simp 8588893Simp# MKMODULESENV is set here so that port makefiles can augment 8688893Simp# them. 8788893Simp 8888893SimpMKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR} 8988893Simp.if defined(MODULES_OVERRIDE) 9088893SimpMKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}" 9188893Simp.endif 9288893Simp.if defined(DEBUG) 9388893SimpMKMODULESENV+= DEBUG="${DEBUG}" DEBUG_FLAGS="${DEBUG}" 9488893Simp.endif 9588893Simp 9686253Simpall: ${KERNEL_KO} 97