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