Makefile.booters revision 1.56
11.56Smatt# $NetBSD: Makefile.booters,v 1.56 2011/02/20 07:50:25 matt Exp $
21.54Sjoerg
31.54SjoergNOMAN=		# defined
41.42Slukem
51.53Sjoerg.include <bsd.own.mk>
61.42Slukem.include <bsd.sys.mk>		# for HOST_SH
71.5Smellon
81.27Ssimonb# $S must correspond to the top of the 'sys' tree
91.27SsimonbS=	${.CURDIR}/../../../..
101.27Ssimonb
111.27SsimonbBINMODE?=	444
121.41Ssimonb
131.41Ssimonb# XXX SHOULD NOT NEED TO DEFINE THESE!
141.41SsimonbLIBCRT0=
151.41SsimonbLIBC=
161.41SsimonbLIBCRTBEGIN=
171.41SsimonbLIBCRTEND=
181.34Sgmcgarry
191.27Ssimonb.PATH:		${.CURDIR}/../common
201.40SjdolecekAFLAGS+=	-D_LOCORE -D_KERNEL -mno-abicalls
211.27Ssimonb# -I${.CURDIR}/../.. done by Makefile.inc
221.32SsimonbCPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES \
231.32Ssimonb		-I${.OBJDIR} -I${S}
241.27Ssimonb# compiler flags for smallest code size
251.39SjdolecekCFLAGS=		-ffreestanding -Os -g -mmemcpy -mno-abicalls -G 128
261.47StsutsuiCFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
271.47StsutsuiCFLAGS+=	-Werror
281.32SsimonbLDBUG=		-T $S/arch/mips/conf/stand.ldscript
291.27Ssimonb
301.56Smatt.if ${MACHINE_ARCH} == "mips64el"
311.56SmattAFLAGS+=	-mips3 -mabi=32
321.56SmattCFLAGS+=	-mips3 -mabi=32
331.56SmattLDBUG+=		-m elf32ltsmip
341.56SmattMACHINE_ARCH=	mipsel
351.56Smatt.endif
361.56Smatt
371.42SlukemNETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
381.27SsimonbCPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
391.27Ssimonb
401.27SsimonbPRIMARY_LOAD_ADDRESS?=	0x80700000
411.27SsimonbSECONDARY_LOAD_ADDRESS?=0x80710000
421.37Sjdolecek
431.27Ssimonb.if defined(PRIMARY_PROG)
441.27SsimonbPROG=		${PRIMARY_PROG}
451.27SsimonbSRCS =		start.S bootxx.c callvec.c
461.27SsimonbSRCS+=		devopen.c conf.c rz.c
471.27SsimonbSRCS+=		bootinit.S bootread.S clear_cache.S printf.S
481.27Ssimonb
491.27SsimonbLOAD_ADDRESS=	${PRIMARY_LOAD_ADDRESS}
501.27Ssimonb# Pick a number, any number...
511.27SsimonbPRIMARY_MAX_TOTAL!=	expr 16 \* 1024
521.27Ssimonb
531.27SsimonbCPPFLAGS+=	-DPRIMARY_BOOTBLOCK \
541.27Ssimonb		-DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
551.27Ssimonb		-DNO_GETCHAR \
561.27Ssimonb		-DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
571.27Ssimonb		-DLIBSA_NO_FS_CLOSE \
581.27Ssimonb		-DLIBSA_NO_DEV_CLOSE \
591.48She		-DLIBSA_NO_DEV_IOCTL \
601.27Ssimonb		-DLIBSA_SINGLE_DEVICE=rz \
611.27Ssimonb		-D"rzioctl(x,y,z)=EINVAL" -D"rzclose(f)=0" \
621.27Ssimonb		-DLIBSA_NO_TWIDDLE \
631.27Ssimonb		-DLIBSA_NO_FD_CHECKING \
641.27Ssimonb		-DLIBSA_NO_RAW_ACCESS \
651.27Ssimonb		-DLIBSA_NO_DISKLABEL_MSGS \
661.49Stsutsui		-DALLOC_FIRST_FIT
671.27Ssimonb
681.42SlukemCHECKSIZE_CMD?=	SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
691.27Ssimonb
701.27Ssimonb.elif defined(SECONDARY_PROG)
711.27SsimonbPROG=		${SECONDARY_PROG}
721.27SsimonbLOAD_ADDRESS=	${SECONDARY_LOAD_ADDRESS}
731.27SsimonbCPPFLAGS+=	-DSECONDARY_BOOTBLOCK
741.30SjdolecekSRCS+=	vers.c
751.30SjdolecekCLEANFILES+= vers.c
761.27Ssimonb.else
771.27Ssimonb# XXX ?
781.27Ssimonb.endif
791.18Ssimonb
801.27Ssimonb### find out what to use for libkern
811.27SsimonbKERN_AS=	library
821.27Ssimonb.include "${S}/lib/libkern/Makefile.inc"
831.27SsimonbLIBKERN=	${KERNLIB}
841.18Ssimonb
851.18Ssimonb### find out what to use for libz
861.27Ssimonb.if defined(PRIMARY_PROG)
871.27SsimonbLIBZ=
881.27Ssimonb.else
891.18SsimonbZ_AS=		library
901.18Ssimonb.include "${S}/lib/libz/Makefile.inc"
911.18SsimonbLIBZ=		${ZLIB}
921.27Ssimonb.endif
931.18Ssimonb
941.27Ssimonb### find out what to use for libsa
951.27SsimonbSA_AS=		library
961.27Ssimonb.if defined(PRIMARY_PROG)
971.27SsimonbSAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
981.27Ssimonb.endif
991.27Ssimonb.if defined(SECONDARY_PROG)
1001.27SsimonbSAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
1011.33SgmcgarrySAMISCMAKEFLAGS+=SA_INCLUDE_NET=yes
1021.22Ssimonb.endif
1031.27Ssimonb.include "${S}/lib/libsa/Makefile.inc"
1041.27SsimonbLIBSA=		${SALIB}
1051.18Ssimonb
1061.27SsimonbLIBS=		${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
1071.36Sgmcgarry
1081.30Sjdolecekvers.c: ${.CURDIR}/version
1091.55Stsutsui	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
1101.53Sjoerg	    -N ${.CURDIR}/version "pmax"
1111.18Ssimonb
1121.50Stsutsui${PROG}: ${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.50Stsutsui.include <bsd.klinks.mk>
1281.31Stsutsui.include <bsd.prog.mk>
1291.31Stsutsui
1301.51StsutsuiCLEANFILES+=	${PROG}.map ${PROG}.elf
1311.20Ssimonb
1321.52Sdhollandcleandir distclean: .WAIT cleanlibdir
1331.20Ssimonb
1341.20Ssimonbcleanlibdir:
1351.44Sjmc	-rm -rf lib
136