Makefile.booters revision 1.53
1# $NetBSD: Makefile.booters,v 1.53 2003/10/08 18:20:15 dsl 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" 16COPTS= -Os -m32 17CPPFLAGS+= -DBOOT_ELF64 18.else 19COPTS= -Os -mcpu=i386 20.endif 21COPTS+= -ffreestanding 22 23I386_STAND_DIR?= $S/arch/i386/stand 24 25.PATH: ${I386_STAND_DIR}/lib 26 27.PATH: ${I386_STAND_DIR}/lib/crt/rom 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 41 42# XXX 43.if ${MACHINE_ARCH} == "x86_64" 44CPPFLAGS+=-m32 45LD+=-m elf_i386 46LIBKERN_ARCH=i386 47KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386" 48.endif 49 50CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list 51SRCS+= vers.c 52 53.if !make(obj) && !make(clean) && !make(cleandir) 54.BEGIN: machine x86 lib 55.NOPATH: machine x86 56.endif 57 58realdepend realall: machine x86 lib 59CLEANFILES+= machine x86 60 61machine:: x86 62 -rm -f $@ 63 ln -s $S/arch/i386/include $@ 64 65x86:: 66 -rm -f $@ 67 ln -s $S/arch/x86/include $@ 68 69${OBJS} ${ROMSTART} ${DOSSTART} ${PXESTART}: machine x86 lib 70 71lib: 72.ifdef LIBOBJ 73 -rm -f $@ 74 ln -s ${LIBOBJ}/lib . 75.else 76 mkdir lib 77.endif 78 79### find out what to use for libkern 80KERN_AS= library 81.include "${S}/lib/libkern/Makefile.inc" 82LIBKERN= ${KERNLIB} 83 84### find out what to use for libz 85Z_AS= library 86.include "${S}/lib/libz/Makefile.inc" 87LIBZ= ${ZLIB} 88 89### find out what to use for libsa 90SA_AS= library 91SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 92.include "${S}/lib/libsa/Makefile.inc" 93LIBSA= ${SALIB} 94 95### find out what to use for libi386 96I386DIR= ${I386_STAND_DIR}/lib 97.include "${I386DIR}/Makefile.inc" 98LIBI386= ${I386LIB} 99 100cleandir distclean: cleanlibdir 101 102cleanlibdir: 103 rm -rf lib 104 105.if ${OBJECT_FMT} == "ELF" 106LDFLAGS=-M -e start # -N does not work properly. 107.else 108LDFLAGS=-N -M -e _start 109.endif 110 111LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} 112 113vers.c: ${VERSIONFILE} ${SOURCES} 114 sh ${S}conf/newvers_stand.sh ${.ALLSRC} ${MACHINE} ${NEWVERSWHAT} 115 116CLEANFILES+= ${BASE}.sym 117${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 118 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} \ 119 ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list 120 121CLEANFILES+= ${BASE}.rom 122${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 123 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 124 ${LIBLIST} >${BASE}.list 125 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 126 ${GENPROM} ${ROM_SIZE} < ${BASE}.bin > ${BASE}.rom || \ 127 rm -f ${BASE}.rom 128 rm -f ${BASE}.bin 129 130CLEANFILES+= ${BASE}.com 131${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 132 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 133 ${LIBLIST} >${BASE}.list 134 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com 135 136CLEANFILES+= ${BASE}.bin 137${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} 138 ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} ${STARTFILE} ${OBJS} \ 139 ${LIBLIST} > ${BASE}.list 140 ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin 141 142.include <bsd.prog.mk> 143