Makefile.booters revision 1.54
11.54Sjoerg# $NetBSD: Makefile.booters,v 1.54 2011/01/23 13:18:57 joerg 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.42SlukemNETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
311.27SsimonbCPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
321.27Ssimonb
331.27SsimonbPRIMARY_LOAD_ADDRESS?=	0x80700000
341.27SsimonbSECONDARY_LOAD_ADDRESS?=0x80710000
351.37Sjdolecek
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