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