167204Sobrien# $FreeBSD: stable/10/sys/boot/powerpc/ofw/Makefile 314922 2017-03-08 22:39:45Z pfg $
267204Sobrien
3156813Sru.include <bsd.own.mk>
4188895SruMK_SSP=		no
5156813Sru
6125634SgrehanPROG=		loader
7174930SmarcelNEWVERSWHAT=	"Open Firmware loader" ${MACHINE_ARCH}
867204SobrienBINDIR?=	/boot
983368SruINSTALLFLAGS=	-b
1067204Sobrien
11125634Sgrehan# Architecture-specific loader code
12123375SgrehanSRCS=		conf.c metadata.c vers.c start.c
13209920SnwhitehornSRCS+=		ucmpdi2.c
14123375Sgrehan
1568548SbennoLOADER_DISK_SUPPORT?=	yes
16123375SgrehanLOADER_UFS_SUPPORT?=	yes
17123375SgrehanLOADER_CD9660_SUPPORT?=	yes
18123375SgrehanLOADER_EXT2FS_SUPPORT?=	no
1968548SbennoLOADER_NET_SUPPORT?=	yes
20123375SgrehanLOADER_NFS_SUPPORT?=	yes
21176185SrajLOADER_TFTP_SUPPORT?=	no
22123375SgrehanLOADER_GZIP_SUPPORT?=	yes
23123375SgrehanLOADER_BZIP2_SUPPORT?=	no
2467204Sobrien
25125634Sgrehan.if ${LOADER_DISK_SUPPORT} == "yes"
2667204SobrienCFLAGS+=	-DLOADER_DISK_SUPPORT
2768548Sbenno.endif
28123375Sgrehan.if ${LOADER_UFS_SUPPORT} == "yes"
29123375SgrehanCFLAGS+=	-DLOADER_UFS_SUPPORT
30123375Sgrehan.endif
31123375Sgrehan.if ${LOADER_CD9660_SUPPORT} == "yes"
32123375SgrehanCFLAGS+=	-DLOADER_CD9660_SUPPORT
33123375Sgrehan.endif
34123375Sgrehan.if ${LOADER_EXT2FS_SUPPORT} == "yes"
35123375SgrehanCFLAGS+=	-DLOADER_EXT2FS_SUPPORT
36123375Sgrehan.endif
37125634Sgrehan.if ${LOADER_GZIP_SUPPORT} == "yes"
38125634SgrehanCFLAGS+=	-DLOADER_GZIP_SUPPORT
39125634Sgrehan.endif
40125634Sgrehan.if ${LOADER_BZIP2_SUPPORT} == "yes"
41125634SgrehanCFLAGS+=	-DLOADER_BZIP2_SUPPORT
42125634Sgrehan.endif
43125634Sgrehan.if ${LOADER_NET_SUPPORT} == "yes"
4468548SbennoCFLAGS+=	-DLOADER_NET_SUPPORT
4568548Sbenno.endif
46123375Sgrehan.if ${LOADER_NFS_SUPPORT} == "yes"
47123375SgrehanCFLAGS+=	-DLOADER_NFS_SUPPORT
48123375Sgrehan.endif
49123375Sgrehan.if ${LOADER_TFTP_SUPPORT} == "yes"
50123375SgrehanCFLAGS+=	-DLOADER_TFTP_SUPPORT
51123375Sgrehan.endif
5267204Sobrien
53156813Sru.if ${MK_FORTH} != "no"
54123375Sgrehan# Enable BootForth
55123375SgrehanBOOT_FORTH=	yes
56314922SpfgCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl
57314922SpfgCFLAGS+=	-I${.CURDIR}/../../ficl/powerpc
58123375SgrehanLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
59123375Sgrehan.endif
6067204Sobrien
61204129Snwhitehorn# Avoid the open-close-dance for every file access as some firmwares perform
62204129Snwhitehorn# an auto-negotiation on every open of the network interface and thus causes
63204129Snwhitehorn# netbooting to take horribly long.
64204129SnwhitehornCFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE
65204129Snwhitehorn
66125634Sgrehan# Always add MI sources
67209920Snwhitehorn.PATH:		${.CURDIR}/../../common ${.CURDIR}/../../../libkern
68125634Sgrehan.include	"${.CURDIR}/../../common/Makefile.inc"
69209920SnwhitehornCFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}/../../..
70125634SgrehanCFLAGS+=	-I.
7167204Sobrien
72125634SgrehanCLEANFILES+=	vers.c loader.help
7367204Sobrien
74176479SmarcelCFLAGS+=	-ffreestanding -msoft-float
75131811Sgrehan# load address. set in linker script
76123375SgrehanRELOC?=		0x1C00000
77123375SgrehanCFLAGS+=	-DRELOC=${RELOC}
7867204Sobrien
79131811SgrehanLDFLAGS=	-nostdlib -static -T ${.CURDIR}/ldscript.powerpc
80131811Sgrehan
81132997Sgrehan# 64-bit bridge extensions
82132997SgrehanCFLAGS+= -Wa,-mppc64bridge
83132997Sgrehan
84123375Sgrehan# Pull in common loader code
85123375Sgrehan.PATH:		${.CURDIR}/../../ofw/common
86125634Sgrehan.include	"${.CURDIR}/../../ofw/common/Makefile.inc"
87123375Sgrehan
88133862Smarius# Open Firmware standalone support library
8967204SobrienLIBOFW=		${.OBJDIR}/../../ofw/libofw/libofw.a
9067204SobrienCFLAGS+=	-I${.CURDIR}/../../ofw/libofw
9167204Sobrien
9267204Sobrien# where to get libstand from
93271130SemasteLIBSTAND=	${.OBJDIR}/../../libstand32/libstand.a
9467204SobrienCFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
9567204Sobrien
96125634SgrehanDPADD=		${LIBFICL} ${LIBOFW} ${LIBSTAND}
97271130SemasteLDADD=		${LIBFICL} ${LIBOFW} ${LIBSTAND}
9867204Sobrien
99123375Sgrehanvers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
10067204Sobrien	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
10167204Sobrien
102125634Sgrehanloader.help: help.common help.ofw
103123375Sgrehan	cat ${.ALLSRC} | \
104123375Sgrehan	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
10567204Sobrien
106123375Sgrehan.PATH: ${.CURDIR}/../../forth
107281843Sdteske.include	"${.CURDIR}/../../forth/Makefile.inc"
108123375Sgrehan
109293294SdteskeFILES+= loader.rc menu.rc
11067204Sobrien
11167204Sobrien.include <bsd.prog.mk>
112