Makefile.booters revision 1.42
1# $NetBSD: Makefile.booters,v 1.42 2003/02/03 00:08:30 briggs 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 48CPPFLAGS+= -D__daddr_t=int32_t 49 50# XXX 51.if ${MACHINE_ARCH} == "x86_64" 52CPPFLAGS+=-m32 53LD+=-m elf_i386 54LIBKERN_ARCH=i386 55KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386" 56.endif 57 58CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list 59SRCS+= vers.c 60 61.if !make(obj) && !make(clean) && !make(cleandir) 62.BEGIN: machine 63.NOPATH: machine 64.endif 65 66realdepend realall: machine 67CLEANFILES+= machine 68 69machine:: 70 -rm -f $@ 71 ln -s $S/arch/i386/include $@ 72 73${OBJS} ${BSSTART} ${ROMSTART} ${DOSSTART} ${PXESTART}: machine 74 75### find out what to use for libkern 76KERN_AS= library 77.include "${S}/lib/libkern/Makefile.inc" 78LIBKERN= ${KERNLIB} 79 80### find out what to use for libz 81Z_AS= library 82.include "${S}/lib/libz/Makefile.inc" 83LIBZ= ${ZLIB} 84 85### find out what to use for libsa 86SA_AS= library 87SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 88.include "${S}/lib/libsa/Makefile.inc" 89LIBSA= ${SALIB} 90 91### find out what to use for libi386 92I386DIR= ${I386_STAND_DIR}/lib 93.include "${I386DIR}/Makefile.inc" 94LIBI386= ${I386LIB} 95 96cleandir distclean: cleanlibdir 97 98cleanlibdir: 99 rm -rf lib 100 101.if ${OBJECT_FMT} == "ELF" 102LDFLAGS=-M -e start # -N does not work properly. 103.else 104LDFLAGS=-N -M -e _start 105.endif 106 107LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} 108 109vers.c: ${VERSIONFILE} ${SOURCES} 110 sh ${S}conf/newvers_stand.sh ${.ALLSRC} 'i386' ${NEWVERSWHAT} 111 112CLEANFILES+= ${BASE}.sym 113${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 114 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} \ 115 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 116 117CLEANFILES+= ${BASE}.rom 118${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 119 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 120 ${LIBLIST} >${BASE}.list 121 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 122 ${GENPROM} ${ROM_SIZE} < ${BASE}.bin > ${BASE}.rom || \ 123 rm -f ${BASE}.rom 124 rm -f ${BASE}.bin 125 126CLEANFILES+= ${BASE}.com 127${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 128 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 129 ${LIBLIST} >${BASE}.list 130 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com 131 132CLEANFILES+= ${BASE}.bin 133${BASE}.bin: ${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}.bin 137 138.include <bsd.prog.mk> 139