Makefile.booters revision 1.69
1# $NetBSD: Makefile.booters,v 1.69 2006/07/12 13:51:18 yamt 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 17CPPFLAGS+= -DBOOT_ELF64 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 28COPTS= -Os -ffreestanding 29 30I386_STAND_DIR?= $S/arch/i386/stand 31 32.PATH: ${I386_STAND_DIR}/lib 33 34ROMSTART= start_rom.o 35GENPROMDIR= ${I386_STAND_DIR}/genprom 36GENPROMOBJDIR!= cd ${GENPROMDIR} && ${PRINTOBJDIR} 37GENPROM= ${GENPROMOBJDIR}/genprom 38 39.PATH: ${I386_STAND_DIR}/lib/crt/dos 40DOSSTART= start_dos.o doscommain.o 41 42.PATH: ${I386_STAND_DIR}/lib/crt/pxe 43PXESTART= start_pxe.o 44 45CPPFLAGS+= -nostdinc -I${.OBJDIR} -I$S -I${I386_STAND_DIR}/lib \ 46 -I${S}/../common/include -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: cleanlibdir 95 96cleanlibdir: 97 -rm -rf lib 98 99.if ${OBJECT_FMT} == "ELF" 100LDFLAGS+=-Wl,-M -Wl,-e,start # -N does not work properly. 101.else 102LDFLAGS+=-Wl,-N -Wl,-M -Wl,-e,_start 103.endif 104 105LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} 106 107vers.c: ${VERSIONFILE} ${SOURCES} 108 ${HOST_SH} ${S}conf/newvers_stand.sh ${.ALLSRC} ${MACHINE} ${NEWVERSWHAT} 109 110CLEANFILES+= ${BASE}.sym 111${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 112 ${_MKTARGET_LINK} 113 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 114 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 115 116CLEANFILES+= ${BASE}.rom ${BASE}.rom.tmp 117${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 118 ${_MKTARGET_LINK} 119 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 120 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 121 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.rom.tmp 122 ${GENPROM} ${ROM_SIZE} < ${BASE}.rom.tmp > ${BASE}.rom || \ 123 rm -f ${BASE}.rom 124 rm -f ${BASE}.rom.tmp 125 126CLEANFILES+= ${BASE}.com 127${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 128 ${_MKTARGET_LINK} 129 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 130 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 131 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com 132 133CLEANFILES+= ${BASE}.bin 134${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 135 ${_MKTARGET_LINK} 136 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 137 ${STARTFILE} ${OBJS} ${LIBLIST} > ${BASE}.list 138 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 139 140.include <bsd.prog.mk> 141