1# $FreeBSD$
2
3.include <bsd.own.mk>
4MK_SSP=		no
5
6PROG?=		loader
7NEWVERSWHAT?=	"bootstrap loader" sparc64
8INSTALLFLAGS=	-b
9
10# Architecture-specific loader code
11SRCS=		locore.S main.c metadata.c vers.c
12
13LOADER_DISK_SUPPORT?=	yes
14LOADER_UFS_SUPPORT?=	yes
15LOADER_CD9660_SUPPORT?=	yes
16LOADER_ZFS_SUPPORT?=	no
17LOADER_NET_SUPPORT?=	yes
18LOADER_NFS_SUPPORT?=	yes
19LOADER_TFTP_SUPPORT?=	yes
20LOADER_GZIP_SUPPORT?=	yes
21LOADER_BZIP2_SUPPORT?=	no
22LOADER_DEBUG?=		no
23
24.if ${LOADER_DEBUG} == "yes"
25CFLAGS+=	-DLOADER_DEBUG
26.endif
27.if ${LOADER_DISK_SUPPORT} == "yes"
28CFLAGS+=	-DLOADER_DISK_SUPPORT
29.endif
30.if ${LOADER_UFS_SUPPORT} == "yes"
31CFLAGS+=	-DLOADER_UFS_SUPPORT
32.endif
33.if ${LOADER_CD9660_SUPPORT} == "yes"
34CFLAGS+=	-DLOADER_CD9660_SUPPORT
35.endif
36.if ${LOADER_ZFS_SUPPORT} == "yes"
37CFLAGS+=	-DLOADER_ZFS_SUPPORT
38CFLAGS+=	-I${.CURDIR}/../../zfs
39CFLAGS+=	-I${.CURDIR}/../../../cddl/boot/zfs
40LIBZFSBOOT=	${.OBJDIR}/../../zfs/libzfsboot.a
41.endif
42.if ${LOADER_GZIP_SUPPORT} == "yes"
43CFLAGS+=	-DLOADER_GZIP_SUPPORT
44.endif
45.if ${LOADER_BZIP2_SUPPORT} == "yes"
46CFLAGS+=	-DLOADER_BZIP2_SUPPORT
47.endif
48.if ${LOADER_NET_SUPPORT} == "yes"
49CFLAGS+=	-DLOADER_NET_SUPPORT
50.endif
51.if ${LOADER_NFS_SUPPORT} == "yes"
52CFLAGS+=	-DLOADER_NFS_SUPPORT
53.endif
54.if ${LOADER_TFTP_SUPPORT} == "yes"
55CFLAGS+=	-DLOADER_TFTP_SUPPORT
56.endif
57
58.if ${MK_FORTH} != "no"
59# Enable BootForth
60BOOT_FORTH=	yes
61CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl
62CFLAGS+=	-I${.CURDIR}/../../ficl/sparc64
63LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
64.endif
65
66# Always add MI sources
67.PATH:		${.CURDIR}/../../common
68.include	"${.CURDIR}/../../common/Makefile.inc"
69CFLAGS+=	-I${.CURDIR}/../../common
70CFLAGS+=	-I.
71# Avoid the open-close-dance for every file access as some firmwares perform
72# an auto-negotiation on every open of the network interface and thus causes
73# netbooting to take horribly long.
74CFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE
75
76CLEANFILES+=	vers.c loader.help
77
78LDFLAGS=	-static
79
80# Open Firmware standalone support library
81LIBOFW=		${.OBJDIR}/../../ofw/libofw/libofw.a
82CFLAGS+=	-I${.CURDIR}/../../ofw/libofw/
83
84# where to get libstand from
85CFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
86
87DPADD=		${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
88LDADD=		${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand
89
90vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version
91	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \
92	    ${NEWVERSWHAT}
93
94loader.help: help.common help.sparc64
95	cat ${.ALLSRC} | \
96	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
97
98.PATH: ${.CURDIR}/../../forth
99FILES=	loader.help loader.4th support.4th loader.conf
100FILES+=	screen.4th frames.4th
101FILES+=	beastie.4th brand.4th check-password.4th color.4th delay.4th
102FILES+=	menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
103FILESDIR_loader.conf=	/boot/defaults
104
105.if !exists(${DESTDIR}/boot/loader.rc)
106FILES+= loader.rc
107.endif
108
109.if !exists(${DESTDIR}/boot/menu.rc)
110FILES+= menu.rc
111.endif
112
113.include <bsd.prog.mk>
114