184974Srobert# $FreeBSD$
284974Srobert
3156813Sru.include <bsd.own.mk>
4188895SruMK_SSP=		no
5156813Sru
6234898SmariusPROG?=		loader
7234898SmariusNEWVERSWHAT?=	"bootstrap loader" sparc64
893677StmmINSTALLFLAGS=	-b
984974Srobert
1097432Sjake# Architecture-specific loader code
1199541SjakeSRCS=		locore.S main.c metadata.c vers.c
1285720Sjake
1393677StmmLOADER_DISK_SUPPORT?=	yes
1493677StmmLOADER_UFS_SUPPORT?=	yes
1598594SjakeLOADER_CD9660_SUPPORT?=	yes
16234898SmariusLOADER_ZFS_SUPPORT?=	no
1799560SjakeLOADER_NET_SUPPORT?=	yes
1899560SjakeLOADER_NFS_SUPPORT?=	yes
1999560SjakeLOADER_TFTP_SUPPORT?=	yes
20105065SjakeLOADER_GZIP_SUPPORT?=	yes
21105065SjakeLOADER_BZIP2_SUPPORT?=	no
22234898SmariusLOADER_DEBUG?=		no
2391114Sjake
24234898Smarius.if ${LOADER_DEBUG} == "yes"
25234898SmariusCFLAGS+=	-DLOADER_DEBUG
26234898Smarius.endif
2791114Sjake.if ${LOADER_DISK_SUPPORT} == "yes"
2891114SjakeCFLAGS+=	-DLOADER_DISK_SUPPORT
2991114Sjake.endif
3093606Stmm.if ${LOADER_UFS_SUPPORT} == "yes"
3193606StmmCFLAGS+=	-DLOADER_UFS_SUPPORT
3293606Stmm.endif
3393606Stmm.if ${LOADER_CD9660_SUPPORT} == "yes"
3493606StmmCFLAGS+=	-DLOADER_CD9660_SUPPORT
3593606Stmm.endif
36234898Smarius.if ${LOADER_ZFS_SUPPORT} == "yes"
37234898SmariusCFLAGS+=	-DLOADER_ZFS_SUPPORT
38234898SmariusCFLAGS+=	-I${.CURDIR}/../../zfs
39234898SmariusCFLAGS+=	-I${.CURDIR}/../../../cddl/boot/zfs
40235364SavgLIBZFSBOOT=	${.OBJDIR}/../../zfs/libzfsboot.a
41234898Smarius.endif
42105065Sjake.if ${LOADER_GZIP_SUPPORT} == "yes"
43105065SjakeCFLAGS+=	-DLOADER_GZIP_SUPPORT
44105065Sjake.endif
45105065Sjake.if ${LOADER_BZIP2_SUPPORT} == "yes"
46105065SjakeCFLAGS+=	-DLOADER_BZIP2_SUPPORT
47105065Sjake.endif
4891114Sjake.if ${LOADER_NET_SUPPORT} == "yes"
4991114SjakeCFLAGS+=	-DLOADER_NET_SUPPORT
5091114Sjake.endif
5191114Sjake.if ${LOADER_NFS_SUPPORT} == "yes"
5291114SjakeCFLAGS+=	-DLOADER_NFS_SUPPORT
5391114Sjake.endif
5491114Sjake.if ${LOADER_TFTP_SUPPORT} == "yes"
5591114SjakeCFLAGS+=	-DLOADER_TFTP_SUPPORT
5691114Sjake.endif
5791114Sjake
58156813Sru.if ${MK_FORTH} != "no"
5997432Sjake# Enable BootForth
6097432SjakeBOOT_FORTH=	yes
61234898SmariusCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl
62234898SmariusCFLAGS+=	-I${.CURDIR}/../../ficl/sparc64
6397432SjakeLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
6497432Sjake.endif
6584974Srobert
66201932Smarius# Always add MI sources
6784974Srobert.PATH:		${.CURDIR}/../../common
68125622Sru.include	"${.CURDIR}/../../common/Makefile.inc"
6984974SrobertCFLAGS+=	-I${.CURDIR}/../../common
70125622SruCFLAGS+=	-I.
71201932Smarius# Avoid the open-close-dance for every file access as some firmwares perform
72201932Smarius# an auto-negotiation on every open of the network interface and thus causes
73201932Smarius# netbooting to take horribly long.
74201932SmariusCFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE
7584974Srobert
76125622SruCLEANFILES+=	vers.c loader.help
7784974Srobert
78125622SruLDFLAGS=	-static
7984974Srobert
80133862Smarius# Open Firmware standalone support library
8197432SjakeLIBOFW=		${.OBJDIR}/../../ofw/libofw/libofw.a
8297432SjakeCFLAGS+=	-I${.CURDIR}/../../ofw/libofw/
8397432Sjake
8484974Srobert# where to get libstand from
8584974SrobertCFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
8684974Srobert
87235364SavgDPADD=		${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
88235364SavgLDADD=		${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand
8997432Sjake
90234898Smariusvers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version
91234898Smarius	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \
92234898Smarius	    ${NEWVERSWHAT}
9397432Sjake
94125622Sruloader.help: help.common help.sparc64
9593677Stmm	cat ${.ALLSRC} | \
9693677Stmm	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
9784974Srobert
9897432Sjake.PATH: ${.CURDIR}/../../forth
99125622SruFILES=	loader.help loader.4th support.4th loader.conf
100222472SjulianFILES+=	screen.4th frames.4th
101222417SjulianFILES+=	beastie.4th brand.4th check-password.4th color.4th delay.4th
102242688SdteskeFILES+=	menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
10397432SjakeFILESDIR_loader.conf=	/boot/defaults
10497432Sjake
10584974Srobert.if !exists(${DESTDIR}/boot/loader.rc)
10697432SjakeFILES+= loader.rc
10784974Srobert.endif
10884974Srobert
109222417Sjulian.if !exists(${DESTDIR}/boot/menu.rc)
110222417SjulianFILES+= menu.rc
111222417Sjulian.endif
112222417Sjulian
11384974Srobert.include <bsd.prog.mk>
114