1 # $NetBSD: Makefile.booters,v 1.14 2009/03/17 00:35:08 he Exp $
3 .include <bsd.sys.mk> # for HOST_SH
5 S= ${.CURDIR}/../../../..
7 MIPSCO= ${S}/arch/mipsco
9 .PATH: ${.CURDIR}/../common
14 # XXX SHOULD NOT NEED TO DEFINE THESE!
21 beforedepend: machine-links
23 machine-links: machine mipsco mips
26 ln -s ${MIPSCO}/include ${.TARGET}
30 ln -s ${MIPS}/include ${.TARGET}
32 CLEANFILES+= machine mipsco mips
34 realall: machine-links ${PROG}
36 AFLAGS+= -D_LOCORE -D_KERNEL -DASSEMBLER -mno-abicalls
37 # -I${.CURDIR}/../.. done by Makefile.inc
38 CPPFLAGS+= -nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES
39 CPPFLAGS+= -I${.OBJDIR} -I${S}
40 # compiler flags for smallest code size
41 #CFLAGS= -Os -mmemcpy -mno-abicalls -G 128
42 CFLAGS= -Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128
43 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
45 NETBSD_VERS!= ${HOST_SH} ${S}/conf/osrelease.sh
46 CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
48 PRIMARY_LOAD_ADDRESS?= 0x80600000
49 SECONDARY_LOAD_ADDRESS?=0x80610000
51 LDSCRIPT?= ${MIPSCO}/conf/stand.ldscript
55 .if defined(PRIMARY_PROG)
57 SRCS = start.S bootxx.c callvec.c
58 SRCS+= devopen.c conf.c saio.c
61 LOAD_ADDRESS= ${PRIMARY_LOAD_ADDRESS}
63 CPPFLAGS+= -DPRIMARY_BOOTBLOCK \
64 -DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
66 -DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
68 -DLIBSA_NO_DEV_CLOSE \
69 -DLIBSA_NO_DEV_IOCTL \
70 -DLIBSA_SINGLE_DEVICE=saio \
71 -D"saioioctl(x,y,z)=EINVAL" -D"saioclose(f)=0" \
73 -DLIBSA_NO_FD_CHECKING \
74 -DLIBSA_NO_DISKLABEL_MSGS \
75 -DLIBSA_NO_RAW_ACCESS \
79 CHECKSIZE_CMD?= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
81 STRIPSECTIONS?= -R .reginfo -R .mdebug.abi32 -R .comment -R .pdr
83 .elif defined(SECONDARY_PROG)
84 PROG= ${SECONDARY_PROG}
85 LOAD_ADDRESS= ${SECONDARY_LOAD_ADDRESS}
86 CPPFLAGS+= -DSECONDARY_BOOTBLOCK
93 ### find out what to use for libkern
95 .include "${S}/lib/libkern/Makefile.inc"
98 ### find out what to use for libz
99 .if defined(PRIMARY_PROG)
103 .include "${S}/lib/libz/Makefile.inc"
107 ### find out what to use for libsa
109 .if defined(PRIMARY_PROG)
110 SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
112 .if defined(SECONDARY_PROG)
113 SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
115 SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
117 .include "${S}/lib/libsa/Makefile.inc"
120 LIBS= ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
123 vers.c: ${.CURDIR}/version
124 ${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "mipsco"
126 ${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
127 ${LD} ${OFORMAT} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
128 -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
130 .if defined(PRIMARY_PROG)
131 mv ${PROG} ${PROG}.elf
132 ${OBJCOPY} --strip-all -O ecoff-bigmips ${STRIPSECTIONS} \
135 .if defined(CHECKSIZE_CMD)
136 @${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} || \
137 (rm -f ${PROG} ; false)
140 CLEANFILES+= ${PROG}.map ${PROG}.elf
142 cleandir distclean: cleanlibdir
147 .include <bsd.prog.mk>