Makefile.booters revision 1.85
1# $NetBSD: Makefile.booters,v 1.85 2011/06/20 06:52:37 mrg 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 defined(HAVE_GCC) 16.if ${MACHINE_ARCH} == "x86_64" 17CPUFLAGS= -m32 18.else 19CPUFLAGS= -march=i386 -mtune=i386 20.endif 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} vers.c ${BASE}.list 52SRCS+= vers.c 53 54CLEANFILES+= machine x86 55 56.if !make(obj) && !make(clean) && !make(cleandir) 57.BEGIN: 58 -rm -f machine && ln -s $S/arch/i386/include machine 59 -rm -f x86 && ln -s $S/arch/x86/include x86 60.ifdef LIBOBJ 61 -rm -f lib && ln -s ${LIBOBJ}/lib lib 62 mkdir -p ${LIBOBJ}/lib 63.endif 64.endif 65 66### find out what to use for libkern 67KERN_AS= library 68.include "${S}/lib/libkern/Makefile.inc" 69LIBKERN= ${KERNLIB} 70 71### find out what to use for libz 72Z_AS= library 73.include "${S}/lib/libz/Makefile.inc" 74LIBZ= ${ZLIB} 75 76### find out what to use for libsa 77SA_AS= library 78SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 79.include "${S}/lib/libsa/Makefile.inc" 80LIBSA= ${SALIB} 81 82### find out what to use for libi386 83I386DIR= ${I386_STAND_DIR}/lib 84.include "${I386DIR}/Makefile.inc" 85LIBI386= ${I386LIB} 86 87cleandir distclean: .WAIT cleanlibdir 88 89cleanlibdir: 90 -rm -rf lib 91 92LDFLAGS+=-Wl,-M -Wl,-e,start # -N does not work properly. 93 94LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} 95 96vers.c: ${VERSIONFILE} ${SOURCES} ${S}/conf/newvers_stand.sh 97 ${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT} 98 99CLEANFILES+= ${BASE}.sym 100${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 101 ${_MKTARGET_LINK} 102 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 103 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 104 105CLEANFILES+= ${BASE}.rom ${BASE}.rom.tmp 106${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 107 ${_MKTARGET_LINK} 108 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 109 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 110 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.rom.tmp 111 ${GENPROM} ${ROM_SIZE} < ${BASE}.rom.tmp > ${BASE}.rom || \ 112 ( rm -f ${BASE}.rom && false ) 113 rm -f ${BASE}.rom.tmp 114 115CLEANFILES+= ${BASE}.com 116${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 117 ${_MKTARGET_LINK} 118 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 119 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 120 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com 121 122CLEANFILES+= ${BASE}.bin 123${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 124 ${_MKTARGET_LINK} 125 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 126 ${STARTFILE} ${OBJS} ${LIBLIST} > ${BASE}.list 127 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 128 129.include <bsd.prog.mk> 130