Makefile.conf revision 84603
1132718Skan# $FreeBSD: head/release/picobsd/build/Makefile.conf 84603 2001-10-07 00:21:13Z luigi $
2132718Skan#
3132718Skan# Makefile for building PICOBSD kernels and running crunchgen
4132718Skan#
5132718Skan# Needs SRC pointing to the source tree,
690075Sobrien# MY_TREE ponting to my tree
7132718Skan# BUILDDIR pointing to the build directory
890075Sobrien# PICO_OBJ pointing to the object directory
990075Sobrien# When building a kernel, also need ${name} from the environment
1090075Sobrien# and CONFIG may indicate an alternate config program
1190075Sobrien
1290075SobrienSRC?=/usr/src
1390075SobrienCONFIG?=config
1490075Sobrien
1590075Sobrien# These 3 variables determine where the kernel is built.
1690075Sobrien# If config were smart enough, we could place the config
1790075Sobrien# file in some other place than ${SRC}/sys/i386/conf, but
1890075Sobrien# at the moment (Oct.2001) this is not possible yet.
1952284SobrienCONF=${SRC}/sys/i386/conf
20132718Skan#CONF=${BUILDDIR}/conf         # XXX does not work yet
2152284SobrienCONFFILE=PICOBSD-${name}
2252284Sobrien
2352284Sobrien# We can, however, compile the kernel somewhere else
2452284Sobrien#COMPILE=${CONF}/../compile/${CONFFILE}
2552284SobrienCOMPILE=${BUILDDIR}/${CONFFILE}
2690075Sobrien
2752284SobrienKERNFILE=${COMPILE}/kernel
2852284Sobrien
2952284Sobrien${BUILDDIR}/kernel: ${KERNFILE}
3050397Sobrien	cp -p ${.OODATE} ${.TARGET}
3190075Sobrien	strip ${.TARGET}
3290075Sobrien	strip --remove-section=.note --remove-section=.comment ${.TARGET}
3390075Sobrien
3490075Sobrien${KERNFILE}: ${COMPILE} do_a_make_in_the_kernel_directory_anyways
3590075Sobrien
36132718Skando_a_make_in_the_kernel_directory_anyways:
3790075Sobrien	(cd ${COMPILE}; make KERNEL=kernel -DNO_MODULES)
3890075Sobrien
3990075Sobrien${COMPILE}: ${CONF}/${CONFFILE}
4090075Sobrien	(cd ${CONF}; ${CONFIG} -d ${COMPILE} ${CONFFILE}; \
4190075Sobrien	cd ${COMPILE}; make KERNEL=kernel -DNO_MODULES depend )
4290075Sobrien
4390075Sobrien${CONF}/${CONFFILE}: PICOBSD
4490075Sobrien	# -mkdir -p ${CONF}		# XXX not needed yet.
4550397Sobrien	cp ${.OODATE} ${.TARGET}
4690075Sobrien	if [ -f PICOBSD.hints ] ; then cp PICOBSD.hints ${CONF}/PICOBSD.hints ; fi
4750397Sobrien
4850397Sobrien# This part creates crunch1.conf and crunch.mk from crunch.conf
4950397Sobrien${BUILDDIR}/crunch.mk: ${BUILDDIR}/crunch1.conf
5050397Sobrien	-(cd ${BUILDDIR}/crunch ; \
5190075Sobrien	crunchgen -p ${PICO_OBJ} -o -m ${.TARGET} ${.OODATE} )
5290075Sobrien
5390075Sobrien${BUILDDIR}/crunch1.conf: ${MY_TREE}/crunch.conf
54132718Skan	(cd ${BUILDDIR}/crunch ; cat ${.OODATE} | \
5550397Sobrien	    sed -e "s@/usr/src@${SRC}@" -e "s+@__CWD__@+${MY_TREE}+" > ${.TARGET} )
5650397Sobrien