Makefile.booters revision 1.51
11.51Stsutsui# $NetBSD: Makefile.booters,v 1.51 2009/04/23 16:37:44 tsutsui 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.27SsimonbBINMODE?=	444
91.41Ssimonb
101.41Ssimonb# XXX SHOULD NOT NEED TO DEFINE THESE!
111.41SsimonbLIBCRT0=
121.41SsimonbLIBC=
131.41SsimonbLIBCRTBEGIN=
141.41SsimonbLIBCRTEND=
151.34Sgmcgarry
161.27Ssimonb.PATH:		${.CURDIR}/../common
171.40SjdolecekAFLAGS+=	-D_LOCORE -D_KERNEL -mno-abicalls
181.27Ssimonb# -I${.CURDIR}/../.. done by Makefile.inc
191.32SsimonbCPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES \
201.32Ssimonb		-I${.OBJDIR} -I${S}
211.27Ssimonb# compiler flags for smallest code size
221.39SjdolecekCFLAGS=		-ffreestanding -Os -g -mmemcpy -mno-abicalls -G 128
231.47StsutsuiCFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
241.47StsutsuiCFLAGS+=	-Werror
251.32SsimonbLDBUG=		-T $S/arch/mips/conf/stand.ldscript
261.27Ssimonb
271.42SlukemNETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
281.27SsimonbCPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
291.27Ssimonb
301.27SsimonbPRIMARY_LOAD_ADDRESS?=	0x80700000
311.27SsimonbSECONDARY_LOAD_ADDRESS?=0x80710000
321.37Sjdolecek
331.38SsimonbNOMAN=		# defined
341.27Ssimonb
351.27Ssimonb.if defined(PRIMARY_PROG)
361.27SsimonbPROG=		${PRIMARY_PROG}
371.27SsimonbSRCS =		start.S bootxx.c callvec.c
381.27SsimonbSRCS+=		devopen.c conf.c rz.c
391.27SsimonbSRCS+=		bootinit.S bootread.S clear_cache.S printf.S
401.27Ssimonb
411.27SsimonbLOAD_ADDRESS=	${PRIMARY_LOAD_ADDRESS}
421.27Ssimonb# Pick a number, any number...
431.27SsimonbPRIMARY_MAX_TOTAL!=	expr 16 \* 1024
441.27Ssimonb
451.27SsimonbCPPFLAGS+=	-DPRIMARY_BOOTBLOCK \
461.27Ssimonb		-DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
471.27Ssimonb		-DNO_GETCHAR \
481.27Ssimonb		-DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
491.27Ssimonb		-DLIBSA_NO_FS_CLOSE \
501.27Ssimonb		-DLIBSA_NO_DEV_CLOSE \
511.48She		-DLIBSA_NO_DEV_IOCTL \
521.27Ssimonb		-DLIBSA_SINGLE_DEVICE=rz \
531.27Ssimonb		-D"rzioctl(x,y,z)=EINVAL" -D"rzclose(f)=0" \
541.27Ssimonb		-DLIBSA_NO_TWIDDLE \
551.27Ssimonb		-DLIBSA_NO_FD_CHECKING \
561.27Ssimonb		-DLIBSA_NO_RAW_ACCESS \
571.27Ssimonb		-DLIBSA_NO_DISKLABEL_MSGS \
581.49Stsutsui		-DALLOC_FIRST_FIT
591.27Ssimonb
601.42SlukemCHECKSIZE_CMD?=	SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
611.27Ssimonb
621.27Ssimonb.elif defined(SECONDARY_PROG)
631.27SsimonbPROG=		${SECONDARY_PROG}
641.27SsimonbLOAD_ADDRESS=	${SECONDARY_LOAD_ADDRESS}
651.27SsimonbCPPFLAGS+=	-DSECONDARY_BOOTBLOCK
661.30SjdolecekSRCS+=	vers.c
671.30SjdolecekCLEANFILES+= vers.c
681.27Ssimonb.else
691.27Ssimonb# XXX ?
701.27Ssimonb.endif
711.18Ssimonb
721.27Ssimonb### find out what to use for libkern
731.27SsimonbKERN_AS=	library
741.27Ssimonb.include "${S}/lib/libkern/Makefile.inc"
751.27SsimonbLIBKERN=	${KERNLIB}
761.18Ssimonb
771.18Ssimonb### find out what to use for libz
781.27Ssimonb.if defined(PRIMARY_PROG)
791.27SsimonbLIBZ=
801.27Ssimonb.else
811.18SsimonbZ_AS=		library
821.18Ssimonb.include "${S}/lib/libz/Makefile.inc"
831.18SsimonbLIBZ=		${ZLIB}
841.27Ssimonb.endif
851.18Ssimonb
861.27Ssimonb### find out what to use for libsa
871.27SsimonbSA_AS=		library
881.27Ssimonb.if defined(PRIMARY_PROG)
891.27SsimonbSAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
901.27Ssimonb.endif
911.27Ssimonb.if defined(SECONDARY_PROG)
921.27SsimonbSAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
931.33SgmcgarrySAMISCMAKEFLAGS+=SA_INCLUDE_NET=yes
941.22Ssimonb.endif
951.27Ssimonb.include "${S}/lib/libsa/Makefile.inc"
961.27SsimonbLIBSA=		${SALIB}
971.18Ssimonb
981.27SsimonbLIBS=		${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
991.36Sgmcgarry
1001.36Sgmcgarry.include <bsd.own.mk>
1011.18Ssimonb
1021.30Sjdolecekvers.c: ${.CURDIR}/version
1031.42Slukem	${HOST_SH} ${S}/conf/newvers_stand.sh -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.20Ssimonbcleandir distclean: cleanlibdir
1261.20Ssimonb
1271.20Ssimonbcleanlibdir:
1281.44Sjmc	-rm -rf lib
129