NetBSD/sys/arch/i386/stand/Makefile.booters
briggs f6909b984b Revert my last change. While it actually allows a build to finish,
an iso-image created from the resulting release won't boot.  I don't
know if this change is the source of that, but one more knowledgable
than I about the x86 booter needs to look at this, and I don't want
the waters muddied any more than necessary.
2003-02-03 03:03:16 +00:00

138 lines
3.6 KiB
Makefile

# $NetBSD: Makefile.booters,v 1.43 2003/02/03 03:03:16 briggs Exp $
.include <bsd.own.mk>
STRIPFLAG=
BINMODE=444
LIBCRT0= # nothing
LIBCRTBEGIN= # nothing
LIBCRTEND= # nothing
LIBC= # nothing
# Make sure we override any optimization options specified by the
# user.
.if ${MACHINE_ARCH} == "x86_64"
COPTS= -Os -m32
CPPFLAGS+= -DBOOT_ELF64
.else
COPTS= -Os -mcpu=i386
.endif
COPTS+= -ffreestanding
I386_STAND_DIR?= $S/arch/i386/stand
.PATH: ${I386_STAND_DIR}/lib/crt/bootsect ${I386_STAND_DIR}/lib
# ensure the stuff we need to load all of 'biosboot' in in the first few
# sectors, and that anything that goes to real mode is in the first 64k.
# (prot_to_real will bleat if the return address is >64k)
BSSTART= start_bootsect.o fraglist.o bootsectmain.o biosdisk_ll.o \
bios_disk.o diskbuf.o \
biosdelay.o biosgetrtc.o biosmca.o biosmem.o biosmemx.o \
biosreboot.o conio.o
.PATH: ${I386_STAND_DIR}/lib/crt/rom
ROMSTART= start_rom.o
GENPROMDIR= ${I386_STAND_DIR}/genprom
GENPROMOBJDIR!= cd ${GENPROMDIR} && ${PRINTOBJDIR}
GENPROM= ${GENPROMOBJDIR}/genprom
.PATH: ${I386_STAND_DIR}/lib/crt/dos
DOSSTART= start_dos.o doscommain.o
.PATH: ${I386_STAND_DIR}/lib/crt/pxe
PXESTART= start_pxe.o
CPPFLAGS += -nostdinc -I${.OBJDIR} -I$S -I${I386_STAND_DIR}/lib -I$S/lib/libsa
CPPFLAGS+= -D_STANDALONE
# XXX
.if ${MACHINE_ARCH} == "x86_64"
CPPFLAGS+=-m32
LD+=-m elf_i386
LIBKERN_ARCH=i386
KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
.endif
CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
SRCS+= vers.c
.if !make(obj) && !make(clean) && !make(cleandir)
.BEGIN: machine
.NOPATH: machine
.endif
realdepend realall: machine
CLEANFILES+= machine
machine::
-rm -f $@
ln -s $S/arch/i386/include $@
${OBJS} ${BSSTART} ${ROMSTART} ${DOSSTART} ${PXESTART}: machine
### find out what to use for libkern
KERN_AS= library
.include "${S}/lib/libkern/Makefile.inc"
LIBKERN= ${KERNLIB}
### find out what to use for libz
Z_AS= library
.include "${S}/lib/libz/Makefile.inc"
LIBZ= ${ZLIB}
### find out what to use for libsa
SA_AS= library
SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
.include "${S}/lib/libsa/Makefile.inc"
LIBSA= ${SALIB}
### find out what to use for libi386
I386DIR= ${I386_STAND_DIR}/lib
.include "${I386DIR}/Makefile.inc"
LIBI386= ${I386LIB}
cleandir distclean: cleanlibdir
cleanlibdir:
rm -rf lib
.if ${OBJECT_FMT} == "ELF"
LDFLAGS=-M -e start # -N does not work properly.
.else
LDFLAGS=-N -M -e _start
.endif
LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA}
vers.c: ${VERSIONFILE} ${SOURCES}
sh ${S}conf/newvers_stand.sh ${.ALLSRC} 'i386' ${NEWVERSWHAT}
CLEANFILES+= ${BASE}.sym
${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} \
${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
CLEANFILES+= ${BASE}.rom
${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \
${LIBLIST} >${BASE}.list
${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin
${GENPROM} ${ROM_SIZE} < ${BASE}.bin > ${BASE}.rom || \
rm -f ${BASE}.rom
rm -f ${BASE}.bin
CLEANFILES+= ${BASE}.com
${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \
${LIBLIST} >${BASE}.list
${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com
CLEANFILES+= ${BASE}.bin
${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \
${LIBLIST} > ${BASE}.list
${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin
.include <bsd.prog.mk>