Makefile.booters revision 1.87
1# $NetBSD: Makefile.booters,v 1.87 2013/08/21 08:15:19 matt 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 52### find out what to use for libkern 53KERN_AS= library 54.include "${S}/lib/libkern/Makefile.inc" 55LIBKERN= ${KERNLIB} 56 57### find out what to use for libz 58Z_AS= library 59.include "${S}/lib/libz/Makefile.inc" 60LIBZ= ${ZLIB} 61 62### find out what to use for libsa 63SA_AS= library 64SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 65.include "${S}/lib/libsa/Makefile.inc" 66LIBSA= ${SALIB} 67 68### find out what to use for libi386 69I386DIR= ${I386_STAND_DIR}/lib 70.include "${I386DIR}/Makefile.inc" 71LIBI386= ${I386LIB} 72 73cleandir distclean: .WAIT cleanlibdir 74 75cleanlibdir: 76 -rm -rf lib 77 78LDFLAGS+=-Wl,-M -Wl,-e,start # -N does not work properly. 79 80LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} 81 82vers.c: ${VERSIONFILE} ${SOURCES} ${S}/conf/newvers_stand.sh 83 ${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT} 84 85CLEANFILES+= ${BASE}.sym 86${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 87 ${_MKTARGET_LINK} 88 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 89 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 90 91CLEANFILES+= ${BASE}.rom ${BASE}.rom.tmp 92${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 93 ${_MKTARGET_LINK} 94 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 95 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 96 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.rom.tmp 97 ${GENPROM} ${ROM_SIZE} < ${BASE}.rom.tmp > ${BASE}.rom || \ 98 ( rm -f ${BASE}.rom && false ) 99 rm -f ${BASE}.rom.tmp 100 101CLEANFILES+= ${BASE}.com 102${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 103 ${_MKTARGET_LINK} 104 ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \ 105 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 106 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com 107 108CLEANFILES+= ${BASE}.bin 109${BASE}.bin: ${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 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 114 115.include <bsd.prog.mk> 116.include <bsd.klinks.mk> 117