Makefile.booters revision 1.42
11.42Slukem# $NetBSD: Makefile.booters,v 1.42 2003/10/26 07:25:37 lukem Exp $
21.42Slukem
31.42Slukem.include <bsd.sys.mk>		# for HOST_SH
41.5Smellon
51.27Ssimonb# $S must correspond to the top of the 'sys' tree
61.27SsimonbS=	${.CURDIR}/../../../..
71.27Ssimonb
81.28Smycroft.BEGIN: machine pmax mips
91.28Smycroft${PROG} realdepend realall: machine pmax mips
101.27SsimonbCLEANFILES+= machine pmax mips
111.28Smycroftmachine:
121.18Ssimonb	-rm -f ${.TARGET}
131.18Ssimonb	ln -s $S/arch/${MACHINE}/include ${.TARGET}
141.28Smycroftpmax:
151.27Ssimonb	-rm -f ${.TARGET}
161.27Ssimonb	ln -s $S/arch/${MACHINE}/include ${.TARGET}
171.28Smycroftmips:
181.18Ssimonb	-rm -f ${.TARGET}
191.18Ssimonb	ln -s $S/arch/mips/include mips
201.1Sderaadt
211.27SsimonbBINMODE?=	444
221.41Ssimonb
231.41Ssimonb# XXX SHOULD NOT NEED TO DEFINE THESE!
241.41SsimonbLIBCRT0=
251.41SsimonbLIBC=
261.41SsimonbLIBCRTBEGIN=
271.41SsimonbLIBCRTEND=
281.34Sgmcgarry
291.27Ssimonb.PATH:		${.CURDIR}/../common
301.40SjdolecekAFLAGS+=	-D_LOCORE -D_KERNEL -mno-abicalls
311.27Ssimonb# -I${.CURDIR}/../.. done by Makefile.inc
321.32SsimonbCPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES \
331.32Ssimonb		-I${.OBJDIR} -I${S}
341.27Ssimonb# compiler flags for smallest code size
351.39SjdolecekCFLAGS=		-ffreestanding -Os -g -mmemcpy -mno-abicalls -G 128
361.32SsimonbOFORMAT=	--oformat elf32-littlemips
371.32SsimonbLDBUG=		-T $S/arch/mips/conf/stand.ldscript
381.27Ssimonb
391.42SlukemNETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
401.27SsimonbCPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
411.27Ssimonb
421.27SsimonbPRIMARY_LOAD_ADDRESS?=	0x80700000
431.27SsimonbSECONDARY_LOAD_ADDRESS?=0x80710000
441.37Sjdolecek
451.38SsimonbNOMAN=		# defined
461.27Ssimonb
471.27Ssimonb.if defined(PRIMARY_PROG)
481.27SsimonbPROG=		${PRIMARY_PROG}
491.27SsimonbSRCS =		start.S bootxx.c callvec.c
501.27SsimonbSRCS+=		devopen.c conf.c rz.c
511.27SsimonbSRCS+=		bootinit.S bootread.S clear_cache.S printf.S
521.27Ssimonb
531.27SsimonbLOAD_ADDRESS=	${PRIMARY_LOAD_ADDRESS}
541.27Ssimonb# Pick a number, any number...
551.27SsimonbPRIMARY_MAX_TOTAL!=	expr 16 \* 1024
561.27Ssimonb
571.27SsimonbCPPFLAGS+=	-DPRIMARY_BOOTBLOCK \
581.27Ssimonb		-DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
591.27Ssimonb		-DNO_GETCHAR \
601.27Ssimonb		-DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
611.27Ssimonb		-DLIBSA_NO_FS_CLOSE \
621.27Ssimonb		-DLIBSA_NO_DEV_CLOSE \
631.27Ssimonb		-DLIBSA_SINGLE_DEVICE=rz \
641.27Ssimonb		-D"rzioctl(x,y,z)=EINVAL" -D"rzclose(f)=0" \
651.27Ssimonb		-DLIBSA_NO_TWIDDLE \
661.27Ssimonb		-DLIBSA_NO_FD_CHECKING \
671.27Ssimonb		-DLIBSA_NO_RAW_ACCESS \
681.27Ssimonb		-DLIBSA_NO_DISKLABEL_MSGS \
691.27Ssimonb		-DALLOC_FIRST_FIT \
701.27Ssimonb		-DLIBSA_USE_MEMCPY -DLIBSA_USE_MEMSET
711.27Ssimonb
721.42SlukemCHECKSIZE_CMD?=	SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
731.27Ssimonb
741.27Ssimonb.elif defined(SECONDARY_PROG)
751.27SsimonbPROG=		${SECONDARY_PROG}
761.27SsimonbLOAD_ADDRESS=	${SECONDARY_LOAD_ADDRESS}
771.27SsimonbCPPFLAGS+=	-DSECONDARY_BOOTBLOCK
781.30SjdolecekSRCS+=	vers.c
791.30SjdolecekCLEANFILES+= vers.c
801.27Ssimonb.else
811.27Ssimonb# XXX ?
821.27Ssimonb.endif
831.18Ssimonb
841.27Ssimonb### find out what to use for libkern
851.27SsimonbKERN_AS=	library
861.27Ssimonb.include "${S}/lib/libkern/Makefile.inc"
871.27SsimonbLIBKERN=	${KERNLIB}
881.18Ssimonb
891.18Ssimonb### find out what to use for libz
901.27Ssimonb.if defined(PRIMARY_PROG)
911.27SsimonbLIBZ=
921.27Ssimonb.else
931.18SsimonbZ_AS=		library
941.18Ssimonb.include "${S}/lib/libz/Makefile.inc"
951.18SsimonbLIBZ=		${ZLIB}
961.27Ssimonb.endif
971.18Ssimonb
981.27Ssimonb### find out what to use for libsa
991.27SsimonbSA_AS=		library
1001.27Ssimonb.if defined(PRIMARY_PROG)
1011.27SsimonbSAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
1021.27Ssimonb.endif
1031.27Ssimonb.if defined(SECONDARY_PROG)
1041.27SsimonbSAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
1051.33SgmcgarrySAMISCMAKEFLAGS+=SA_INCLUDE_NET=yes
1061.22Ssimonb.endif
1071.27Ssimonb.include "${S}/lib/libsa/Makefile.inc"
1081.27SsimonbLIBSA=		${SALIB}
1091.18Ssimonb
1101.27SsimonbLIBS=		${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
1111.36Sgmcgarry
1121.36Sgmcgarry.include <bsd.own.mk>
1131.18Ssimonb
1141.30Sjdolecek.PHONY: vers.c
1151.30Sjdolecekvers.c: ${.CURDIR}/version
1161.42Slukem	${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "pmax"
1171.18Ssimonb
1181.30Sjdolecek${PROG}: machine mips pmax ${OBJS} ${LIBS}
1191.32Ssimonb	${LD} ${OFORMAT} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
1201.32Ssimonb	    ${LDBUG} -e start -o ${PROG} ${OBJS} ${LIBS}
1211.27Ssimonb	@${SIZE} ${PROG}
1221.27Ssimonb.if defined(CHECKSIZE_CMD)
1231.27Ssimonb	@${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} ${PRIMARY_MAX_TOTAL} || \
1241.27Ssimonb	    (rm -f ${PROG} ; false)
1251.33Sgmcgarry.endif
1261.33Sgmcgarry.if defined(DO_ECOFF_BINARY)
1271.33Sgmcgarry	@echo -n "Creating ECOFF binary... "
1281.33Sgmcgarry	@mv ${PROG} ${PROG}.elf
1291.34Sgmcgarry	@${ELF2ECOFF} ${PROG}.elf ${PROG}
1301.33Sgmcgarry	@echo done.
1311.27Ssimonb.endif
1321.18Ssimonb
1331.31Stsutsui.include <bsd.prog.mk>
1341.31Stsutsui
1351.27SsimonbCLEANFILES+=	${PROG}.map
1361.20Ssimonb
1371.20Ssimonbcleandir distclean: cleanlibdir
1381.20Ssimonb
1391.20Ssimonbcleanlibdir:
1401.20Ssimonb	rm -rf lib
141