1# $NetBSD: Makefile.booters,v 1.5 2002/11/16 08:48:13 wdk Exp $ 2 3S= ${.CURDIR}/../../../.. 4MIPS= ${S}/arch/mips 5MIPSCO= ${S}/arch/mipsco 6 7.PATH: ${.CURDIR}/../common 8 9BINMODE?= 444 10 11.PHONY: machine-links 12beforedepend: machine-links 13 14machine-links: machine mipsco mips 15machine mipsco: 16 -rm -f ${.TARGET} 17 ln -s ${MIPSCO}/include ${.TARGET} 18 19mips: 20 -rm -f ${.TARGET} 21 ln -s ${MIPS}/include ${.TARGET} 22 23CLEANFILES+= machine mipsco mips 24 25realall: machine-links ${PROG} 26 27AFLAGS+= -D_LOCORE -D_KERNEL -DASSEMBLER -mno-abicalls 28# -I${.CURDIR}/../.. done by Makefile.inc 29CPPFLAGS+= -nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES 30CPPFLAGS+= -I${.OBJDIR} -I${S} 31# compiler flags for smallest code size 32#CFLAGS= -Os -mmemcpy -mno-abicalls -G 128 33CFLAGS= -Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128 34OFORMAT= --oformat elf32-bigmips 35 36NETBSD_VERS!= sh ${S}/conf/osrelease.sh 37CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 38 39PRIMARY_LOAD_ADDRESS?= 0x80600000 40SECONDARY_LOAD_ADDRESS?=0x80610000 41 42LDSCRIPT?= ${MIPSCO}/conf/stand.ldscript 43 44.if defined(PRIMARY_PROG) 45PROG= ${PRIMARY_PROG} 46SRCS = start.S bootxx.c callvec.c 47SRCS+= devopen.c conf.c saio.c 48SRCS+= prom.S 49 50LOAD_ADDRESS= ${PRIMARY_LOAD_ADDRESS} 51 52CPPFLAGS+= -DPRIMARY_BOOTBLOCK \ 53 -DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \ 54 -DNO_GETCHAR \ 55 -DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \ 56 -DLIBSA_NO_FS_CLOSE \ 57 -DLIBSA_NO_DEV_CLOSE \ 58 -DLIBSA_SINGLE_DEVICE=saio \ 59 -D"saioioctl(x,y,z)=EINVAL" -D"saioclose(f)=0" \ 60 -DLIBSA_NO_TWIDDLE \ 61 -DLIBSA_NO_FD_CHECKING \ 62 -DLIBSA_NO_DISKLABEL_MSGS \ 63 -DLIBSA_NO_RAW_ACCESS \ 64 -DALLOC_FIRST_FIT \ 65 -DLIBSA_USE_MEMCPY -DLIBSA_USE_MEMSET 66 67 68CHECKSIZE_CMD?= SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh 69 70.elif defined(SECONDARY_PROG) 71PROG= ${SECONDARY_PROG} 72LOAD_ADDRESS= ${SECONDARY_LOAD_ADDRESS} 73CPPFLAGS+= -DSECONDARY_BOOTBLOCK 74SRCS+= vers.c 75CLEANFILES+= vers.c 76.else 77 78.endif 79 80### find out what to use for libkern 81KERN_AS= library 82.include "${S}/lib/libkern/Makefile.inc" 83LIBKERN= ${KERNLIB} 84 85### find out what to use for libz 86.if defined(PRIMARY_PROG) 87LIBZ= 88.else 89Z_AS= library 90.include "${S}/lib/libz/Makefile.inc" 91LIBZ= ${ZLIB} 92.endif 93 94### find out what to use for libsa 95SA_AS= library 96.if defined(PRIMARY_PROG) 97SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no 98.endif 99.if defined(SECONDARY_PROG) 100SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes 101# for now: 102SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no 103.endif 104.include "${S}/lib/libsa/Makefile.inc" 105LIBSA= ${SALIB} 106 107LIBS= ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} 108 109.PHONY: vers.c 110vers.c: ${.CURDIR}/version 111 sh ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "mipsco" 112 113${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS} 114 ${LD} ${OFORMAT} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \ 115 -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS} 116 @${SIZE} ${PROG} 117.if defined(PRIMARY_PROG) 118 mv ${PROG} ${PROG}.elf 119 ${OBJCOPY} --strip-all -O ecoff-bigmips -R .reginfo ${PROG}.elf ${PROG} 120.endif 121.if defined(CHECKSIZE_CMD) 122 @${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} || \ 123 (rm -f ${PROG} ; false) 124.endif 125 126CLEANFILES+= ${PROG}.map ${PROG}.elf 127 128cleandir distclean: cleanlibdir 129 130cleanlibdir: 131 rm -rf lib 132 133.include <bsd.prog.mk> 134 135/usr/lib/crt0.o: 136 true 137