Makefile.booters revision 1.92
1# $NetBSD: Makefile.booters,v 1.92 2018/06/02 14:30:06 christos Exp $ 2 3NOSANITIZER= 4.include <bsd.own.mk> 5 6STRIPFLAG= 7BINMODE=444 8 9LIBCRT0= # nothing 10LIBCRTI= # nothing 11LIBCRTBEGIN= # nothing 12LIBCRTEND= # nothing 13LIBC= # nothing 14 15# Make sure we override any optimization options specified by the 16# user. 17.if ${MACHINE_ARCH} == "x86_64" 18CPUFLAGS= -m32 -march=i386 -mtune=i386 19.else 20CPUFLAGS= -march=i386 -mtune=i386 21.endif 22COPTS= ${OPT_SIZE.${ACTIVE_CC}} 23 24I386_STAND_DIR?= $S/arch/i386/stand 25 26.PATH: ${I386_STAND_DIR}/lib 27 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 41LDFLAGS+= -nostdlib 42 43# XXX 44.if ${MACHINE_ARCH} == "x86_64" 45CPPFLAGS+=-m32 46LDFLAGS+=-Wl,-m,elf_i386 47LIBKERN_ARCH=i386 48KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386" 49.endif 50 51CLEANFILES+= ${STARTFILE} ${BASE}.list 52 53### find out what to use for libkern 54KERN_AS= library 55.include "${S}/lib/libkern/Makefile.inc" 56LIBKERN= ${KERNLIB} 57 58### find out what to use for libz 59Z_AS= library 60.include "${S}/lib/libz/Makefile.inc" 61LIBZ= ${ZLIB} 62 63### find out what to use for libsa 64SA_AS= library 65SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 66.include "${S}/lib/libsa/Makefile.inc" 67LIBSA= ${SALIB} 68 69### find out what to use for libi386 70I386DIR= ${I386_STAND_DIR}/lib 71.include "${I386DIR}/Makefile.inc" 72LIBI386= ${I386LIB} 73 74cleandir distclean: .WAIT cleanlibdir 75 76cleanlibdir: 77 -rm -rf lib 78 79LDFLAGS+=-Wl,-M -Wl,-e,start # -N does not work properly. 80 81LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} 82 83VERSIONMACHINE=x86 84.include "${S}/conf/newvers_stand.mk" 85 86CLEANFILES+= ${BASE}.sym 87${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 88 ${_MKTARGET_LINK} 89 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 90 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 91 92CLEANFILES+= ${BASE}.rom ${BASE}.rom.tmp 93${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 94 ${_MKTARGET_LINK} 95 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 96 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 97 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.rom.tmp 98 ${GENPROM} ${ROM_SIZE} < ${BASE}.rom.tmp > ${BASE}.rom || \ 99 ( rm -f ${BASE}.rom && false ) 100 rm -f ${BASE}.rom.tmp 101 102CLEANFILES+= ${BASE}.com 103${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 104 ${_MKTARGET_LINK} 105 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 106 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 107 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com 108 109CLEANFILES+= ${BASE}.bin 110${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 111 ${_MKTARGET_LINK} 112 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 113 ${STARTFILE} ${OBJS} ${LIBLIST} > ${BASE}.list 114 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 115 116.include <bsd.prog.mk> 117KLINK_MACHINE= i386 118.include <bsd.klinks.mk> 119