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