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