Makefile.booters revision 1.72
1# $NetBSD: Makefile.booters,v 1.72 2007/09/27 01:57:23 ad 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.if ${HAVE_GCC} != 3 18CPUFLAGS+= -Wno-attributes 19.endif 20.else 21.if ${HAVE_GCC} == 3 22CPUFLAGS= -mcpu=i386 23.else 24CPUFLAGS= -march=i386 -mtune=i386 -Wno-attributes 25.endif 26.endif 27COPTS= -Os -ffreestanding 28 29I386_STAND_DIR?= $S/arch/i386/stand 30 31.PATH: ${I386_STAND_DIR}/lib 32 33ROMSTART= start_rom.o 34GENPROMDIR= ${I386_STAND_DIR}/genprom 35GENPROMOBJDIR!= cd ${GENPROMDIR} && ${PRINTOBJDIR} 36GENPROM= ${GENPROMOBJDIR}/genprom 37 38.PATH: ${I386_STAND_DIR}/lib/crt/dos 39DOSSTART= start_dos.o doscommain.o 40 41.PATH: ${I386_STAND_DIR}/lib/crt/pxe 42PXESTART= start_pxe.o 43 44CPPFLAGS+= -nostdinc -I${.OBJDIR} -I$S -I${I386_STAND_DIR}/lib -I$S/lib/libsa 45CPPFLAGS+= -D_STANDALONE 46LDFLAGS+= -nostdlib 47 48# XXX 49.if ${MACHINE_ARCH} == "x86_64" 50CPPFLAGS+=-m32 51LDFLAGS+=-Wl,-m,elf_i386 52LIBKERN_ARCH=i386 53KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386" 54.endif 55 56CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list 57SRCS+= vers.c 58 59CLEANFILES+= machine x86 60 61.if !make(obj) && !make(clean) && !make(cleandir) 62.BEGIN: 63 -rm -f machine && ln -s $S/arch/i386/include machine 64 -rm -f x86 && ln -s $S/arch/x86/include x86 65.ifdef LIBOBJ 66 -rm -f lib && ln -s ${LIBOBJ}/lib lib 67 mkdir -p ${LIBOBJ}/lib 68.endif 69.endif 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+=-Wl,-M -Wl,-e,start # -N does not work properly. 99.else 100LDFLAGS+=-Wl,-N -Wl,-M -Wl,-e,_start 101.endif 102 103LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} 104 105vers.c: ${VERSIONFILE} ${SOURCES} 106 ${HOST_SH} ${S}conf/newvers_stand.sh ${.ALLSRC} x86 ${NEWVERSWHAT} 107 108CLEANFILES+= ${BASE}.sym 109${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 110 ${_MKTARGET_LINK} 111 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 112 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 113 114CLEANFILES+= ${BASE}.rom ${BASE}.rom.tmp 115${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 116 ${_MKTARGET_LINK} 117 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 118 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 119 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.rom.tmp 120 ${GENPROM} ${ROM_SIZE} < ${BASE}.rom.tmp > ${BASE}.rom || \ 121 rm -f ${BASE}.rom 122 rm -f ${BASE}.rom.tmp 123 124CLEANFILES+= ${BASE}.com 125${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 126 ${_MKTARGET_LINK} 127 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 128 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 129 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com 130 131CLEANFILES+= ${BASE}.bin 132${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 133 ${_MKTARGET_LINK} 134 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 135 ${STARTFILE} ${OBJS} ${LIBLIST} > ${BASE}.list 136 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 137 138.include <bsd.prog.mk> 139