Makefile.booters revision 1.45
11.45Ssimonb# $NetBSD: Makefile.booters,v 1.45 2005/01/01 07:00:51 simonb 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.43She.if !make(obj) && !make(clean) && !make(cleandir)
91.43She.BEGIN:
101.43She	@[ -h machine ] || ln -s $S/arch/${MACHINE}/include machine
111.43She	@[ -h pmax ] || ln -s $S/arch/${MACHINE}/include pmax
121.43She	@[ -h mips ] || ln -s $S/arch/mips/include mips
131.43She.NOPATH: machine pmax mips
141.43She.endif
151.27SsimonbCLEANFILES+= machine pmax mips
161.1Sderaadt
171.27SsimonbBINMODE?=	444
181.41Ssimonb
191.41Ssimonb# XXX SHOULD NOT NEED TO DEFINE THESE!
201.41SsimonbLIBCRT0=
211.41SsimonbLIBC=
221.41SsimonbLIBCRTBEGIN=
231.41SsimonbLIBCRTEND=
241.34Sgmcgarry
251.27Ssimonb.PATH:		${.CURDIR}/../common
261.40SjdolecekAFLAGS+=	-D_LOCORE -D_KERNEL -mno-abicalls
271.27Ssimonb# -I${.CURDIR}/../.. done by Makefile.inc
281.32SsimonbCPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES \
291.32Ssimonb		-I${.OBJDIR} -I${S}
301.27Ssimonb# compiler flags for smallest code size
311.39SjdolecekCFLAGS=		-ffreestanding -Os -g -mmemcpy -mno-abicalls -G 128
321.32SsimonbLDBUG=		-T $S/arch/mips/conf/stand.ldscript
331.27Ssimonb
341.42SlukemNETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
351.27SsimonbCPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
361.27Ssimonb
371.27SsimonbPRIMARY_LOAD_ADDRESS?=	0x80700000
381.27SsimonbSECONDARY_LOAD_ADDRESS?=0x80710000
391.37Sjdolecek
401.38SsimonbNOMAN=		# defined
411.27Ssimonb
421.27Ssimonb.if defined(PRIMARY_PROG)
431.27SsimonbPROG=		${PRIMARY_PROG}
441.27SsimonbSRCS =		start.S bootxx.c callvec.c
451.27SsimonbSRCS+=		devopen.c conf.c rz.c
461.27SsimonbSRCS+=		bootinit.S bootread.S clear_cache.S printf.S
471.27Ssimonb
481.27SsimonbLOAD_ADDRESS=	${PRIMARY_LOAD_ADDRESS}
491.27Ssimonb# Pick a number, any number...
501.27SsimonbPRIMARY_MAX_TOTAL!=	expr 16 \* 1024
511.27Ssimonb
521.27SsimonbCPPFLAGS+=	-DPRIMARY_BOOTBLOCK \
531.27Ssimonb		-DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
541.27Ssimonb		-DNO_GETCHAR \
551.27Ssimonb		-DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
561.27Ssimonb		-DLIBSA_NO_FS_CLOSE \
571.27Ssimonb		-DLIBSA_NO_DEV_CLOSE \
581.27Ssimonb		-DLIBSA_SINGLE_DEVICE=rz \
591.27Ssimonb		-D"rzioctl(x,y,z)=EINVAL" -D"rzclose(f)=0" \
601.27Ssimonb		-DLIBSA_NO_TWIDDLE \
611.27Ssimonb		-DLIBSA_NO_FD_CHECKING \
621.27Ssimonb		-DLIBSA_NO_RAW_ACCESS \
631.27Ssimonb		-DLIBSA_NO_DISKLABEL_MSGS \
641.27Ssimonb		-DALLOC_FIRST_FIT \
651.27Ssimonb		-DLIBSA_USE_MEMCPY -DLIBSA_USE_MEMSET
661.27Ssimonb
671.42SlukemCHECKSIZE_CMD?=	SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
681.27Ssimonb
691.27Ssimonb.elif defined(SECONDARY_PROG)
701.27SsimonbPROG=		${SECONDARY_PROG}
711.27SsimonbLOAD_ADDRESS=	${SECONDARY_LOAD_ADDRESS}
721.27SsimonbCPPFLAGS+=	-DSECONDARY_BOOTBLOCK
731.30SjdolecekSRCS+=	vers.c
741.30SjdolecekCLEANFILES+= vers.c
751.27Ssimonb.else
761.27Ssimonb# XXX ?
771.27Ssimonb.endif
781.18Ssimonb
791.27Ssimonb### find out what to use for libkern
801.27SsimonbKERN_AS=	library
811.27Ssimonb.include "${S}/lib/libkern/Makefile.inc"
821.27SsimonbLIBKERN=	${KERNLIB}
831.18Ssimonb
841.18Ssimonb### find out what to use for libz
851.27Ssimonb.if defined(PRIMARY_PROG)
861.27SsimonbLIBZ=
871.27Ssimonb.else
881.18SsimonbZ_AS=		library
891.18Ssimonb.include "${S}/lib/libz/Makefile.inc"
901.18SsimonbLIBZ=		${ZLIB}
911.27Ssimonb.endif
921.18Ssimonb
931.27Ssimonb### find out what to use for libsa
941.27SsimonbSA_AS=		library
951.27Ssimonb.if defined(PRIMARY_PROG)
961.27SsimonbSAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
971.27Ssimonb.endif
981.27Ssimonb.if defined(SECONDARY_PROG)
991.27SsimonbSAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
1001.33SgmcgarrySAMISCMAKEFLAGS+=SA_INCLUDE_NET=yes
1011.22Ssimonb.endif
1021.27Ssimonb.include "${S}/lib/libsa/Makefile.inc"
1031.27SsimonbLIBSA=		${SALIB}
1041.18Ssimonb
1051.27SsimonbLIBS=		${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
1061.36Sgmcgarry
1071.36Sgmcgarry.include <bsd.own.mk>
1081.18Ssimonb
1091.30Sjdolecekvers.c: ${.CURDIR}/version
1101.42Slukem	${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "pmax"
1111.18Ssimonb
1121.30Sjdolecek${PROG}: machine mips pmax ${OBJS} ${LIBS}
1131.45Ssimonb	${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
1141.32Ssimonb	    ${LDBUG} -e start -o ${PROG} ${OBJS} ${LIBS}
1151.27Ssimonb	@${SIZE} ${PROG}
1161.27Ssimonb.if defined(CHECKSIZE_CMD)
1171.27Ssimonb	@${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} ${PRIMARY_MAX_TOTAL} || \
1181.27Ssimonb	    (rm -f ${PROG} ; false)
1191.33Sgmcgarry.endif
1201.33Sgmcgarry.if defined(DO_ECOFF_BINARY)
1211.33Sgmcgarry	@echo -n "Creating ECOFF binary... "
1221.33Sgmcgarry	@mv ${PROG} ${PROG}.elf
1231.34Sgmcgarry	@${ELF2ECOFF} ${PROG}.elf ${PROG}
1241.33Sgmcgarry	@echo done.
1251.27Ssimonb.endif
1261.18Ssimonb
1271.31Stsutsui.include <bsd.prog.mk>
1281.31Stsutsui
1291.27SsimonbCLEANFILES+=	${PROG}.map
1301.20Ssimonb
1311.20Ssimonbcleandir distclean: cleanlibdir
1321.20Ssimonb
1331.20Ssimonbcleanlibdir:
1341.44Sjmc	-rm -rf lib
135