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