Makefile.booters revision 1.62
11.62Schristos# $NetBSD: Makefile.booters,v 1.62 2016/09/03 11:34:47 christos Exp $
21.54Sjoerg
31.54SjoergNOMAN=		# defined
41.62SchristosNOPIE=		# defined
51.42Slukem
61.53Sjoerg.include <bsd.own.mk>
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.59StsutsuiLIBCRTI=
161.41SsimonbLIBC=
171.41SsimonbLIBCRTBEGIN=
181.41SsimonbLIBCRTEND=
191.34Sgmcgarry
201.27Ssimonb.PATH:		${.CURDIR}/../common
211.40SjdolecekAFLAGS+=	-D_LOCORE -D_KERNEL -mno-abicalls
221.27Ssimonb# -I${.CURDIR}/../.. done by Makefile.inc
231.32SsimonbCPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES \
241.32Ssimonb		-I${.OBJDIR} -I${S}
251.27Ssimonb# compiler flags for smallest code size
261.39SjdolecekCFLAGS=		-ffreestanding -Os -g -mmemcpy -mno-abicalls -G 128
271.58SjoergCFLAGS+=	-fno-unwind-tables
281.47StsutsuiCFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
291.47StsutsuiCFLAGS+=	-Werror
301.32SsimonbLDBUG=		-T $S/arch/mips/conf/stand.ldscript
311.27Ssimonb
321.56Smatt.if ${MACHINE_ARCH} == "mips64el"
331.56SmattAFLAGS+=	-mips3 -mabi=32
341.56SmattCFLAGS+=	-mips3 -mabi=32
351.56SmattLDBUG+=		-m elf32ltsmip
361.56Smatt.endif
371.56Smatt
381.42SlukemNETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
391.27SsimonbCPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
401.27Ssimonb
411.27SsimonbPRIMARY_LOAD_ADDRESS?=	0x80700000
421.27SsimonbSECONDARY_LOAD_ADDRESS?=0x80710000
431.37Sjdolecek
441.27Ssimonb.if defined(PRIMARY_PROG)
451.27SsimonbPROG=		${PRIMARY_PROG}
461.27SsimonbSRCS =		start.S bootxx.c callvec.c
471.27SsimonbSRCS+=		devopen.c conf.c rz.c
481.27SsimonbSRCS+=		bootinit.S bootread.S clear_cache.S printf.S
491.27Ssimonb
501.27SsimonbLOAD_ADDRESS=	${PRIMARY_LOAD_ADDRESS}
511.27Ssimonb# Pick a number, any number...
521.27SsimonbPRIMARY_MAX_TOTAL!=	expr 16 \* 1024
531.27Ssimonb
541.27SsimonbCPPFLAGS+=	-DPRIMARY_BOOTBLOCK \
551.27Ssimonb		-DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
561.27Ssimonb		-DNO_GETCHAR \
571.27Ssimonb		-DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
581.27Ssimonb		-DLIBSA_NO_FS_CLOSE \
591.27Ssimonb		-DLIBSA_NO_DEV_CLOSE \
601.48She		-DLIBSA_NO_DEV_IOCTL \
611.27Ssimonb		-DLIBSA_SINGLE_DEVICE=rz \
621.27Ssimonb		-D"rzioctl(x,y,z)=EINVAL" -D"rzclose(f)=0" \
631.27Ssimonb		-DLIBSA_NO_TWIDDLE \
641.27Ssimonb		-DLIBSA_NO_FD_CHECKING \
651.27Ssimonb		-DLIBSA_NO_RAW_ACCESS \
661.27Ssimonb		-DLIBSA_NO_DISKLABEL_MSGS \
671.49Stsutsui		-DALLOC_FIRST_FIT
681.27Ssimonb
691.42SlukemCHECKSIZE_CMD?=	SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
701.27Ssimonb
711.27Ssimonb.elif defined(SECONDARY_PROG)
721.27SsimonbPROG=		${SECONDARY_PROG}
731.27SsimonbLOAD_ADDRESS=	${SECONDARY_LOAD_ADDRESS}
741.27SsimonbCPPFLAGS+=	-DSECONDARY_BOOTBLOCK
751.30SjdolecekSRCS+=	vers.c
761.30SjdolecekCLEANFILES+= vers.c
771.27Ssimonb.else
781.27Ssimonb# XXX ?
791.27Ssimonb.endif
801.18Ssimonb
811.27Ssimonb### find out what to use for libkern
821.27SsimonbKERN_AS=	library
831.27Ssimonb.include "${S}/lib/libkern/Makefile.inc"
841.27SsimonbLIBKERN=	${KERNLIB}
851.18Ssimonb
861.18Ssimonb### find out what to use for libz
871.27Ssimonb.if defined(PRIMARY_PROG)
881.27SsimonbLIBZ=
891.27Ssimonb.else
901.18SsimonbZ_AS=		library
911.18Ssimonb.include "${S}/lib/libz/Makefile.inc"
921.18SsimonbLIBZ=		${ZLIB}
931.27Ssimonb.endif
941.18Ssimonb
951.27Ssimonb### find out what to use for libsa
961.27SsimonbSA_AS=		library
971.27Ssimonb.if defined(PRIMARY_PROG)
981.27SsimonbSAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
991.27Ssimonb.endif
1001.27Ssimonb.if defined(SECONDARY_PROG)
1011.27SsimonbSAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
1021.33SgmcgarrySAMISCMAKEFLAGS+=SA_INCLUDE_NET=yes
1031.22Ssimonb.endif
1041.27Ssimonb.include "${S}/lib/libsa/Makefile.inc"
1051.27SsimonbLIBSA=		${SALIB}
1061.18Ssimonb
1071.27SsimonbLIBS=		${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
1081.36Sgmcgarry
1091.30Sjdolecekvers.c: ${.CURDIR}/version
1101.55Stsutsui	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
1111.53Sjoerg	    -N ${.CURDIR}/version "pmax"
1121.18Ssimonb
1131.50Stsutsui${PROG}: ${OBJS} ${LIBS}
1141.45Ssimonb	${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
1151.32Ssimonb	    ${LDBUG} -e start -o ${PROG} ${OBJS} ${LIBS}
1161.27Ssimonb	@${SIZE} ${PROG}
1171.27Ssimonb.if defined(CHECKSIZE_CMD)
1181.27Ssimonb	@${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} ${PRIMARY_MAX_TOTAL} || \
1191.27Ssimonb	    (rm -f ${PROG} ; false)
1201.33Sgmcgarry.endif
1211.33Sgmcgarry.if defined(DO_ECOFF_BINARY)
1221.33Sgmcgarry	@echo -n "Creating ECOFF binary... "
1231.33Sgmcgarry	@mv ${PROG} ${PROG}.elf
1241.34Sgmcgarry	@${ELF2ECOFF} ${PROG}.elf ${PROG}
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