Makefile.conf revision 85833
150479Speter# $FreeBSD: head/release/picobsd/build/Makefile.conf 85833 2001-11-01 16:17:37Z luigi $
250186Sdwhite#
378541Sluigi# Makefile for building PICOBSD kernels and running crunchgen
478541Sluigi#
578541Sluigi# Needs SRC pointing to the source tree,
678541Sluigi# MY_TREE ponting to my tree
778541Sluigi# BUILDDIR pointing to the build directory
878541Sluigi# PICO_OBJ pointing to the object directory
978541Sluigi# When building a kernel, also need ${name} from the environment
1078541Sluigi# and CONFIG may indicate an alternate config program
1150186Sdwhite
1250186SdwhiteSRC?=/usr/src
1378541SluigiCONFIG?=config
1485833SluigiMODULES?=-DNO_MODULES	# do not build them as a default
1550186Sdwhite
1685833Sluigi# caller will set MODULES to empty if modules are needed.
1785833Sluigi# Indeed, it can be used to specify other Makefile options as well.
1885833Sluigi
1984376Sluigi# These 3 variables determine where the kernel is built.
2084603Sluigi# If config were smart enough, we could place the config
2184376Sluigi# file in some other place than ${SRC}/sys/i386/conf, but
2284376Sluigi# at the moment (Oct.2001) this is not possible yet.
2384376SluigiCONF=${SRC}/sys/i386/conf
2484376Sluigi#CONF=${BUILDDIR}/conf         # XXX does not work yet
2575881SjoeCONFFILE=PICOBSD-${name}
2684376Sluigi
2784376Sluigi# We can, however, compile the kernel somewhere else
2884376Sluigi#COMPILE=${CONF}/../compile/${CONFFILE}
2984376SluigiCOMPILE=${BUILDDIR}/${CONFFILE}
3084376Sluigi
3178541SluigiKERNFILE=${COMPILE}/kernel
3250186Sdwhite
3382917Sluigi${BUILDDIR}/kernel: ${KERNFILE}
3482917Sluigi	cp -p ${.OODATE} ${.TARGET}
3582917Sluigi	strip ${.TARGET}
3682917Sluigi	strip --remove-section=.note --remove-section=.comment ${.TARGET}
3750186Sdwhite
3878541Sluigi${KERNFILE}: ${COMPILE} do_a_make_in_the_kernel_directory_anyways
3957038Sluigi
4075881Sjoedo_a_make_in_the_kernel_directory_anyways:
4185833Sluigi	(cd ${COMPILE}; make KERNEL=kernel ${MODULES} )
4250186Sdwhite
4357038Sluigi${COMPILE}: ${CONF}/${CONFFILE}
4484376Sluigi	(cd ${CONF}; ${CONFIG} -d ${COMPILE} ${CONFFILE}; \
4585833Sluigi	cd ${COMPILE}; make KERNEL=kernel ${MODULES} depend )
4657038Sluigi
4778541Sluigi${CONF}/${CONFFILE}: PICOBSD
4884376Sluigi	# -mkdir -p ${CONF}		# XXX not needed yet.
4978541Sluigi	cp ${.OODATE} ${.TARGET}
5078541Sluigi	if [ -f PICOBSD.hints ] ; then cp PICOBSD.hints ${CONF}/PICOBSD.hints ; fi
5157038Sluigi
5278541Sluigi# This part creates crunch1.conf and crunch.mk from crunch.conf
5378541Sluigi${BUILDDIR}/crunch.mk: ${BUILDDIR}/crunch1.conf
5478541Sluigi	-(cd ${BUILDDIR}/crunch ; \
5582598Sluigi	crunchgen -p ${PICO_OBJ} -o -m ${.TARGET} ${.OODATE} )
5678541Sluigi
5778541Sluigi${BUILDDIR}/crunch1.conf: ${MY_TREE}/crunch.conf
5878541Sluigi	(cd ${BUILDDIR}/crunch ; cat ${.OODATE} | \
5984603Sluigi	    sed -e "s@/usr/src@${SRC}@" -e "s+@__CWD__@+${MY_TREE}+" > ${.TARGET} )
60