Makefile.booters revision 1.37
1# $NetBSD: Makefile.booters,v 1.37 2002/11/23 23:34:39 fvdl Exp $ 2 3.include <bsd.own.mk> 4 5STRIPFLAG= 6BINMODE=444 7 8# Make sure we override any optimization options specified by the 9# user. 10.if ${MACHINE_ARCH} == "x86_64" 11COPTS= -Os -m32 12CPPFLAGS+= -DBOOT_ELF64 13.else 14COPTS= -Os -mcpu=i386 15.endif 16COPTS+= -ffreestanding 17 18I386_STAND_DIR?= $S/arch/i386/stand 19 20.PATH: ${I386_STAND_DIR}/lib/crt/bootsect ${I386_STAND_DIR}/lib 21BSSTART= start_bootsect.o fraglist.o bootsectmain.o biosdisk_ll.o \ 22 bios_disk.o diskbuf.o 23 24.PATH: ${I386_STAND_DIR}/lib/crt/rom 25ROMSTART= start_rom.o 26GENPROMDIR= ${I386_STAND_DIR}/genprom 27GENPROMOBJDIR!= cd ${GENPROMDIR} && ${PRINTOBJDIR} 28GENPROM= ${GENPROMOBJDIR}/genprom 29 30.PATH: ${I386_STAND_DIR}/lib/crt/dos 31DOSSTART= start_dos.o doscommain.o 32 33.PATH: ${I386_STAND_DIR}/lib/crt/pxe 34PXESTART= start_pxe.o 35 36CPPFLAGS += -nostdinc -I${.OBJDIR} -I$S -I${I386_STAND_DIR}/lib -I$S/lib/libsa 37CPPFLAGS+= -D_STANDALONE 38 39# XXX 40.if ${MACHINE_ARCH} == "x86_64" 41CPPFLAGS+=-m32 42LD+=-m elf_i386 43LIBKERN_ARCH=i386 44KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386" 45.endif 46 47CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list 48SRCS+= vers.c 49 50.if !make(obj) && !make(clean) && !make(cleandir) 51.BEGIN: machine 52.NOPATH: machine 53.endif 54 55realdepend realall: machine 56CLEANFILES+= machine 57 58machine:: 59 -rm -f $@ 60 ln -s $S/arch/i386/include $@ 61 62${OBJS} ${BSSTART} ${ROMSTART} ${DOSSTART} ${PXESTART}: machine 63 64### find out what to use for libkern 65KERN_AS= library 66.include "${S}/lib/libkern/Makefile.inc" 67LIBKERN= ${KERNLIB} 68 69### find out what to use for libz 70Z_AS= library 71.include "${S}/lib/libz/Makefile.inc" 72LIBZ= ${ZLIB} 73 74### find out what to use for libsa 75SA_AS= library 76SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 77.include "${S}/lib/libsa/Makefile.inc" 78LIBSA= ${SALIB} 79 80### find out what to use for libi386 81I386DIR= ${I386_STAND_DIR}/lib 82.include "${I386DIR}/Makefile.inc" 83LIBI386= ${I386LIB} 84 85cleandir distclean: cleanlibdir 86 87cleanlibdir: 88 rm -rf lib 89 90.if ${OBJECT_FMT} == "ELF" 91LDFLAGS=-M -e start # -N does not work properly. 92.else 93LDFLAGS=-N -M -e _start 94.endif 95 96LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} 97 98vers.c: ${VERSIONFILE} ${SOURCES} 99 sh ${S}conf/newvers_stand.sh ${.ALLSRC} 'i386' ${NEWVERSWHAT} 100 101CLEANFILES+= ${BASE}.sym 102${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 103 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 104 ${LIBLIST} >${BASE}.list 105 106CLEANFILES+= ${BASE}.rom 107${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 108 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 109 ${LIBLIST} >${BASE}.list 110 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 111 ${GENPROM} ${ROM_SIZE} < ${BASE}.bin > ${BASE}.rom || \ 112 rm -f ${BASE}.rom 113 rm -f ${BASE}.bin 114 115CLEANFILES+= ${BASE}.com 116${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 117 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 118 ${LIBLIST} >${BASE}.list 119 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com 120 121CLEANFILES+= ${BASE}.bin 122${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 123 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 124 ${LIBLIST} > ${BASE}.list 125 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 126 127.include <bsd.prog.mk> 128