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