Makefile.booters revision 1.53
11.53Sjoerg# $NetBSD: Makefile.booters,v 1.53 2011/01/22 19:19:21 joerg Exp $
21.42Slukem
31.53Sjoerg.include <bsd.own.mk>
41.42Slukem.include <bsd.sys.mk>		# for HOST_SH
51.5Smellon
61.27Ssimonb# $S must correspond to the top of the 'sys' tree
71.27SsimonbS=	${.CURDIR}/../../../..
81.27Ssimonb
91.27SsimonbBINMODE?=	444
101.41Ssimonb
111.41Ssimonb# XXX SHOULD NOT NEED TO DEFINE THESE!
121.41SsimonbLIBCRT0=
131.41SsimonbLIBC=
141.41SsimonbLIBCRTBEGIN=
151.41SsimonbLIBCRTEND=
161.34Sgmcgarry
171.27Ssimonb.PATH:		${.CURDIR}/../common
181.40SjdolecekAFLAGS+=	-D_LOCORE -D_KERNEL -mno-abicalls
191.27Ssimonb# -I${.CURDIR}/../.. done by Makefile.inc
201.32SsimonbCPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES \
211.32Ssimonb		-I${.OBJDIR} -I${S}
221.27Ssimonb# compiler flags for smallest code size
231.39SjdolecekCFLAGS=		-ffreestanding -Os -g -mmemcpy -mno-abicalls -G 128
241.47StsutsuiCFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
251.47StsutsuiCFLAGS+=	-Werror
261.32SsimonbLDBUG=		-T $S/arch/mips/conf/stand.ldscript
271.27Ssimonb
281.42SlukemNETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
291.27SsimonbCPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
301.27Ssimonb
311.27SsimonbPRIMARY_LOAD_ADDRESS?=	0x80700000
321.27SsimonbSECONDARY_LOAD_ADDRESS?=0x80710000
331.37Sjdolecek
341.38SsimonbNOMAN=		# defined
351.27Ssimonb
361.27Ssimonb.if defined(PRIMARY_PROG)
371.27SsimonbPROG=		${PRIMARY_PROG}
381.27SsimonbSRCS =		start.S bootxx.c callvec.c
391.27SsimonbSRCS+=		devopen.c conf.c rz.c
401.27SsimonbSRCS+=		bootinit.S bootread.S clear_cache.S printf.S
411.27Ssimonb
421.27SsimonbLOAD_ADDRESS=	${PRIMARY_LOAD_ADDRESS}
431.27Ssimonb# Pick a number, any number...
441.27SsimonbPRIMARY_MAX_TOTAL!=	expr 16 \* 1024
451.27Ssimonb
461.27SsimonbCPPFLAGS+=	-DPRIMARY_BOOTBLOCK \
471.27Ssimonb		-DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
481.27Ssimonb		-DNO_GETCHAR \
491.27Ssimonb		-DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
501.27Ssimonb		-DLIBSA_NO_FS_CLOSE \
511.27Ssimonb		-DLIBSA_NO_DEV_CLOSE \
521.48She		-DLIBSA_NO_DEV_IOCTL \
531.27Ssimonb		-DLIBSA_SINGLE_DEVICE=rz \
541.27Ssimonb		-D"rzioctl(x,y,z)=EINVAL" -D"rzclose(f)=0" \
551.27Ssimonb		-DLIBSA_NO_TWIDDLE \
561.27Ssimonb		-DLIBSA_NO_FD_CHECKING \
571.27Ssimonb		-DLIBSA_NO_RAW_ACCESS \
581.27Ssimonb		-DLIBSA_NO_DISKLABEL_MSGS \
591.49Stsutsui		-DALLOC_FIRST_FIT
601.27Ssimonb
611.42SlukemCHECKSIZE_CMD?=	SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
621.27Ssimonb
631.27Ssimonb.elif defined(SECONDARY_PROG)
641.27SsimonbPROG=		${SECONDARY_PROG}
651.27SsimonbLOAD_ADDRESS=	${SECONDARY_LOAD_ADDRESS}
661.27SsimonbCPPFLAGS+=	-DSECONDARY_BOOTBLOCK
671.30SjdolecekSRCS+=	vers.c
681.30SjdolecekCLEANFILES+= vers.c
691.27Ssimonb.else
701.27Ssimonb# XXX ?
711.27Ssimonb.endif
721.18Ssimonb
731.27Ssimonb### find out what to use for libkern
741.27SsimonbKERN_AS=	library
751.27Ssimonb.include "${S}/lib/libkern/Makefile.inc"
761.27SsimonbLIBKERN=	${KERNLIB}
771.18Ssimonb
781.18Ssimonb### find out what to use for libz
791.27Ssimonb.if defined(PRIMARY_PROG)
801.27SsimonbLIBZ=
811.27Ssimonb.else
821.18SsimonbZ_AS=		library
831.18Ssimonb.include "${S}/lib/libz/Makefile.inc"
841.18SsimonbLIBZ=		${ZLIB}
851.27Ssimonb.endif
861.18Ssimonb
871.27Ssimonb### find out what to use for libsa
881.27SsimonbSA_AS=		library
891.27Ssimonb.if defined(PRIMARY_PROG)
901.27SsimonbSAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
911.27Ssimonb.endif
921.27Ssimonb.if defined(SECONDARY_PROG)
931.27SsimonbSAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
941.33SgmcgarrySAMISCMAKEFLAGS+=SA_INCLUDE_NET=yes
951.22Ssimonb.endif
961.27Ssimonb.include "${S}/lib/libsa/Makefile.inc"
971.27SsimonbLIBSA=		${SALIB}
981.18Ssimonb
991.27SsimonbLIBS=		${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
1001.36Sgmcgarry
1011.30Sjdolecekvers.c: ${.CURDIR}/version
1021.53Sjoerg	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-Do} \
1031.53Sjoerg	    -N ${.CURDIR}/version "pmax"
1041.18Ssimonb
1051.50Stsutsui${PROG}: ${OBJS} ${LIBS}
1061.45Ssimonb	${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
1071.32Ssimonb	    ${LDBUG} -e start -o ${PROG} ${OBJS} ${LIBS}
1081.27Ssimonb	@${SIZE} ${PROG}
1091.27Ssimonb.if defined(CHECKSIZE_CMD)
1101.27Ssimonb	@${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} ${PRIMARY_MAX_TOTAL} || \
1111.27Ssimonb	    (rm -f ${PROG} ; false)
1121.33Sgmcgarry.endif
1131.33Sgmcgarry.if defined(DO_ECOFF_BINARY)
1141.33Sgmcgarry	@echo -n "Creating ECOFF binary... "
1151.33Sgmcgarry	@mv ${PROG} ${PROG}.elf
1161.34Sgmcgarry	@${ELF2ECOFF} ${PROG}.elf ${PROG}
1171.33Sgmcgarry	@echo done.
1181.27Ssimonb.endif
1191.18Ssimonb
1201.50Stsutsui.include <bsd.klinks.mk>
1211.31Stsutsui.include <bsd.prog.mk>
1221.31Stsutsui
1231.51StsutsuiCLEANFILES+=	${PROG}.map ${PROG}.elf
1241.20Ssimonb
1251.52Sdhollandcleandir distclean: .WAIT cleanlibdir
1261.20Ssimonb
1271.20Ssimonbcleanlibdir:
1281.44Sjmc	-rm -rf lib
129