Embed boot images built as part of buildworld rather than the

installed ones under /boot (which we may not even have in the
case of a cross build).

This introduced chicken and egg problem - we need boot images
early in the "depend" stage but they have not yet been built.
Work around this by excluding the generated makeboot.c source
from the "depend" list; it's okay because we hardcode all its
dependencies explicitly.  We actually lose the dependency bit
on <sys/types.h> but it's probably okay too as the only thing
we use is the u_char datatype and this is unlikely to change.
After all, it's normal for sloppy cleaning to cause problems.

beast.FreeBSD.org running 5.0-CURRENT alpha has been able to
cross build i386 world with this patch.

Prodded by:	gallatin
This commit is contained in:
Ruslan Ermilov 2002-03-15 11:27:47 +00:00
parent 50e080fe0e
commit f8ee3376c9
2 changed files with 76 additions and 20 deletions

View File

@ -53,17 +53,45 @@ makedevs.c: Makefile rtermcap
./rtermcap xterm | \
file2c 'const char termcap_xterm[] = {' ',0};' \
>> makedevs.c
.if ${MACHINE} == "i386"
file2c 'u_char boot0[] = {' '};' < /boot/boot0 >> makedevs.c
echo "size_t boot0_size = sizeof(boot0);" >> makedevs.c
file2c 'u_char mbr[] = {' '};' < /boot/mbr >> makedevs.c
echo "size_t mbr_size = sizeof(mbr);" >> makedevs.c
.if ${MACHINE_ARCH} == i386
# XXX boot images aren't yet ready when "make depend" is run
.if !make(depend)
SRCS+= makeboot.c
.endif
CLEANFILES+= makeboot.c
.if exists(${.OBJDIR}/../../sys/boot/${MACHINE}/boot0/boot0)
BOOT0= ${.OBJDIR}/../../sys/boot/${MACHINE}/boot0/boot0
.else
BOOT0= /boot/boot0
.endif
makeboot.c: ${BOOT0}
.if ${MACHINE} == "i386"
.if exists(${.OBJDIR}/../../sys/boot/i386/mbr/mbr)
MBR= ${.OBJDIR}/../../sys/boot/i386/mbr/mbr
.else
MBR= /boot/mbr
.endif
makeboot.c: ${MBR}
.elif ${MACHINE} == "pc98"
.if exists(${.OBJDIR}/../../sys/boot/pc98/boot0.5/boot0.5)
BOOT05= ${.OBJDIR}/../../sys/boot/pc98/boot0.5/boot0.5
.else
BOOT05= /boot/boot0.5
.endif
makeboot.c: ${BOOT05}
.endif
makeboot.c: Makefile
echo '#include <sys/types.h>' > makeboot.c
file2c 'u_char boot0[] = {' '};' < ${BOOT0} >> makeboot.c
echo "size_t boot0_size = sizeof(boot0);" >> makeboot.c
.if ${MACHINE} == i386
file2c 'u_char mbr[] = {' '};' < ${MBR} >> makeboot.c
echo "size_t mbr_size = sizeof(mbr);" >> makeboot.c
.elif ${MACHINE} == "pc98"
file2c 'u_char boot05[] = {' '};' < ${BOOT05} >> makeboot.c
echo "size_t boot05_size = sizeof(boot05);" >> makeboot.c
.endif
.if ${MACHINE} == "pc98"
file2c 'u_char boot0[] = {' '};' < /boot/boot0 >> makedevs.c
echo "size_t boot0_size = sizeof(boot0);" >> makedevs.c
file2c 'u_char boot05[] = {' '};' < /boot/boot0.5 >> makedevs.c
echo "size_t boot05_size = sizeof(boot05);" >> makedevs.c
.endif
build-tools: rtermcap

View File

@ -53,17 +53,45 @@ makedevs.c: Makefile rtermcap
./rtermcap xterm | \
file2c 'const char termcap_xterm[] = {' ',0};' \
>> makedevs.c
.if ${MACHINE} == "i386"
file2c 'u_char boot0[] = {' '};' < /boot/boot0 >> makedevs.c
echo "size_t boot0_size = sizeof(boot0);" >> makedevs.c
file2c 'u_char mbr[] = {' '};' < /boot/mbr >> makedevs.c
echo "size_t mbr_size = sizeof(mbr);" >> makedevs.c
.if ${MACHINE_ARCH} == i386
# XXX boot images aren't yet ready when "make depend" is run
.if !make(depend)
SRCS+= makeboot.c
.endif
CLEANFILES+= makeboot.c
.if exists(${.OBJDIR}/../../sys/boot/${MACHINE}/boot0/boot0)
BOOT0= ${.OBJDIR}/../../sys/boot/${MACHINE}/boot0/boot0
.else
BOOT0= /boot/boot0
.endif
makeboot.c: ${BOOT0}
.if ${MACHINE} == "i386"
.if exists(${.OBJDIR}/../../sys/boot/i386/mbr/mbr)
MBR= ${.OBJDIR}/../../sys/boot/i386/mbr/mbr
.else
MBR= /boot/mbr
.endif
makeboot.c: ${MBR}
.elif ${MACHINE} == "pc98"
.if exists(${.OBJDIR}/../../sys/boot/pc98/boot0.5/boot0.5)
BOOT05= ${.OBJDIR}/../../sys/boot/pc98/boot0.5/boot0.5
.else
BOOT05= /boot/boot0.5
.endif
makeboot.c: ${BOOT05}
.endif
makeboot.c: Makefile
echo '#include <sys/types.h>' > makeboot.c
file2c 'u_char boot0[] = {' '};' < ${BOOT0} >> makeboot.c
echo "size_t boot0_size = sizeof(boot0);" >> makeboot.c
.if ${MACHINE} == i386
file2c 'u_char mbr[] = {' '};' < ${MBR} >> makeboot.c
echo "size_t mbr_size = sizeof(mbr);" >> makeboot.c
.elif ${MACHINE} == "pc98"
file2c 'u_char boot05[] = {' '};' < ${BOOT05} >> makeboot.c
echo "size_t boot05_size = sizeof(boot05);" >> makeboot.c
.endif
.if ${MACHINE} == "pc98"
file2c 'u_char boot0[] = {' '};' < /boot/boot0 >> makedevs.c
echo "size_t boot0_size = sizeof(boot0);" >> makedevs.c
file2c 'u_char boot05[] = {' '};' < /boot/boot0.5 >> makedevs.c
echo "size_t boot05_size = sizeof(boot05);" >> makedevs.c
.endif
build-tools: rtermcap