mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 22:12:43 +00:00
60a5d89732
improve support for multi-arch and cross-arch builds, by adding a suffix to the kernel config file and build_directory. (cross builds not clean yet, a cross-built kernel boots but fails when starting /sbin/init)
62 lines
2.0 KiB
Makefile
62 lines
2.0 KiB
Makefile
# $FreeBSD$
|
|
#
|
|
# Makefile for building PICOBSD kernels and running crunchgen
|
|
#
|
|
# Needs SRC pointing to the source tree,
|
|
# MY_TREE ponting to my tree
|
|
# BUILDDIR pointing to the build directory
|
|
# PICO_OBJ pointing to the object directory
|
|
# When building a kernel, also need ${name} from the environment
|
|
# and CONFIG may indicate an alternate config program
|
|
|
|
BINMAKE?=make
|
|
SRC?=/usr/src
|
|
CONFIG?=config
|
|
MODULES?=-DNO_MODULES # do not build them as a default
|
|
KERNCONF ?= PICOBSD
|
|
|
|
# caller will set MODULES to empty if modules are needed.
|
|
# Indeed, it can be used to specify other Makefile options as well.
|
|
|
|
# These 3 variables determine where the kernel is built.
|
|
# If config were smart enough, we could place the config
|
|
# file in some other place than ${SRC}/sys/${TARGET_ARCH}/conf, but
|
|
# at the moment (Oct.2001) this is not possible yet.
|
|
CONF=${SRC}/sys/${TARGET_ARCH}/conf
|
|
#CONF=${BUILDDIR}/conf # XXX does not work yet
|
|
CONFFILE=PICOBSD-${name}
|
|
|
|
# We can, however, compile the kernel somewhere else
|
|
#COMPILE=${CONF}/../compile/${CONFFILE}
|
|
COMPILE=${BUILDDIR}/${CONFFILE}
|
|
|
|
KERNFILE=${COMPILE}/kernel
|
|
|
|
${BUILDDIR}/kernel: ${KERNFILE}
|
|
cp -p ${.OODATE} ${.TARGET}
|
|
strip ${.TARGET}
|
|
strip --remove-section=.note --remove-section=.comment ${.TARGET}
|
|
|
|
${KERNFILE}: ${COMPILE} do_a_make_in_the_kernel_directory_anyways
|
|
|
|
do_a_make_in_the_kernel_directory_anyways:
|
|
(cd ${COMPILE}; ${BINMAKE} KERNEL=kernel ${MODULES} )
|
|
|
|
${COMPILE}: ${CONF}/${CONFFILE}
|
|
(cd ${CONF}; ${CONFIG} -d ${COMPILE} ${CONFFILE}; \
|
|
cd ${COMPILE}; ${BINMAKE} KERNEL=kernel ${MODULES} depend )
|
|
|
|
${CONF}/${CONFFILE}: ${KERNCONF}
|
|
# -mkdir -p ${CONF} # XXX not needed yet.
|
|
cp ${.OODATE} ${.TARGET}
|
|
[ -f PICOBSD.hints ] && cp PICOBSD.hints ${CONF}/
|
|
|
|
# This part creates crunch1.conf and crunch.mk from crunch.conf
|
|
${BUILDDIR}/crunch.mk: ${BUILDDIR}/crunch1.conf
|
|
-(cd ${BUILDDIR}/crunch ; \
|
|
crunchgen -p ${PICO_OBJ} -o -m ${.TARGET} ${.OODATE} )
|
|
|
|
${BUILDDIR}/crunch1.conf: ${MY_TREE}/crunch.conf
|
|
(cd ${BUILDDIR}/crunch ; cat ${.OODATE} | \
|
|
sed -e "s@/usr/src@${SRC}@" -e "s+@__CWD__@+${MY_TREE}+" > ${.TARGET} )
|