xref: /NextBSD/sys/boot/powerpc/ofw/Makefile (revision c21ffb8d6aca32c9584cfa072f309a5890a21aea)
1# $FreeBSD$
2
3.include <src.opts.mk>
4MK_SSP=		no
5MAN=
6
7PROG=		loader
8NEWVERSWHAT=	"Open Firmware loader" ${MACHINE_ARCH}
9BINDIR?=	/boot
10INSTALLFLAGS=	-b
11
12# Architecture-specific loader code
13SRCS=		conf.c metadata.c vers.c start.c
14SRCS+=		ucmpdi2.c
15
16LOADER_DISK_SUPPORT?=	yes
17LOADER_UFS_SUPPORT?=	yes
18LOADER_CD9660_SUPPORT?=	yes
19LOADER_EXT2FS_SUPPORT?=	no
20LOADER_NET_SUPPORT?=	yes
21LOADER_NFS_SUPPORT?=	yes
22LOADER_TFTP_SUPPORT?=	no
23LOADER_GZIP_SUPPORT?=	yes
24LOADER_BZIP2_SUPPORT?=	no
25LOADER_FDT_SUPPORT?=	yes
26
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_EXT2FS_SUPPORT} == "yes"
37CFLAGS+=	-DLOADER_EXT2FS_SUPPORT
38.endif
39.if ${LOADER_GZIP_SUPPORT} == "yes"
40CFLAGS+=	-DLOADER_GZIP_SUPPORT
41.endif
42.if ${LOADER_BZIP2_SUPPORT} == "yes"
43CFLAGS+=	-DLOADER_BZIP2_SUPPORT
44.endif
45.if ${LOADER_NET_SUPPORT} == "yes"
46CFLAGS+=	-DLOADER_NET_SUPPORT
47.endif
48.if ${LOADER_NFS_SUPPORT} == "yes"
49CFLAGS+=	-DLOADER_NFS_SUPPORT
50.endif
51.if ${LOADER_TFTP_SUPPORT} == "yes"
52CFLAGS+=	-DLOADER_TFTP_SUPPORT
53.endif
54.if ${LOADER_FDT_SUPPORT} == "yes"
55SRCS+=		ofwfdt.c
56CFLAGS+=	-I${.CURDIR}/../../fdt
57CFLAGS+=	-I${.OBJDIR}/../../fdt
58CFLAGS+=	-I${.CURDIR}/../../../contrib/libfdt
59CFLAGS+=	-DLOADER_FDT_SUPPORT
60LIBFDT=		${.OBJDIR}/../../fdt/libfdt.a
61.endif
62
63.if ${MK_FORTH} != "no"
64# Enable BootForth
65BOOT_FORTH=	yes
66CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/powerpc
67LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
68.endif
69
70# Avoid the open-close-dance for every file access as some firmwares perform
71# an auto-negotiation on every open of the network interface and thus causes
72# netbooting to take horribly long.
73CFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE
74
75# Always add MI sources
76.PATH:		${.CURDIR}/../../common ${.CURDIR}/../../../libkern
77.include	"${.CURDIR}/../../common/Makefile.inc"
78CFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}/../../..
79CFLAGS+=	-I.
80
81CLEANFILES+=	vers.c loader.help
82
83CFLAGS+=	-ffreestanding -msoft-float
84# load address. set in linker script
85RELOC?=		0x1C00000
86CFLAGS+=	-DRELOC=${RELOC}
87
88LDFLAGS=	-nostdlib -static -T ${.CURDIR}/ldscript.powerpc
89
90# Pull in common loader code
91.PATH:		${.CURDIR}/../../ofw/common
92.include	"${.CURDIR}/../../ofw/common/Makefile.inc"
93
94# Open Firmware standalone support library
95LIBOFW=		${.OBJDIR}/../../ofw/libofw/libofw.a
96CFLAGS+=	-I${.CURDIR}/../../ofw/libofw
97
98# where to get libstand from
99LIBSTAND=	${.OBJDIR}/../../libstand32/libstand.a
100CFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
101
102DPADD=		${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
103LDADD=		${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
104
105vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
106	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
107
108loader.help: help.common help.ofw ${.CURDIR}/../../fdt/help.fdt
109	cat ${.ALLSRC} | \
110	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
111
112.PATH: ${.CURDIR}/../../forth
113.include	"${.CURDIR}/../../forth/Makefile.inc"
114
115FILES+= loader.rc menu.rc
116
117.include <bsd.prog.mk>
118