Makefile revision 278604
1# $FreeBSD: stable/10/sys/boot/arm/uboot/Makefile 278604 2015-02-11 23:05:58Z ian $
2
3.include <bsd.own.mk>
4
5PROG=		ubldr
6NEWVERSWHAT=	"U-Boot loader" ${MACHINE_ARCH}
7BINDIR?=	/boot
8INSTALLFLAGS=	-b
9WARNS?=		1
10# Address at which ubldr will be loaded.
11# This varies for different boards and SOCs.
12UBLDR_LOADADDR?=	0x1000000
13
14# Architecture-specific loader code
15SRCS=		start.S conf.c vers.c
16
17.if !defined(LOADER_NO_DISK_SUPPORT)
18LOADER_DISK_SUPPORT?=	yes
19.else
20LOADER_DISK_SUPPORT=	no
21.endif
22LOADER_UFS_SUPPORT?=	yes
23LOADER_CD9660_SUPPORT?=	no
24LOADER_EXT2FS_SUPPORT?=	no
25.if ${MK_NAND} != "no"
26LOADER_NANDFS_SUPPORT?= yes
27.else
28LOADER_NANDFS_SUPPORT?= no
29.endif
30LOADER_NET_SUPPORT?=	yes
31LOADER_NFS_SUPPORT?=	yes
32LOADER_TFTP_SUPPORT?=	no
33LOADER_GZIP_SUPPORT?=	no
34LOADER_BZIP2_SUPPORT?=	no
35.if ${MK_FDT} != "no"
36LOADER_FDT_SUPPORT=	yes
37.else
38LOADER_FDT_SUPPORT=	no
39.endif
40
41.if ${LOADER_DISK_SUPPORT} == "yes"
42CFLAGS+=	-DLOADER_DISK_SUPPORT
43.endif
44.if ${LOADER_UFS_SUPPORT} == "yes"
45CFLAGS+=	-DLOADER_UFS_SUPPORT
46.endif
47.if ${LOADER_CD9660_SUPPORT} == "yes"
48CFLAGS+=	-DLOADER_CD9660_SUPPORT
49.endif
50.if ${LOADER_EXT2FS_SUPPORT} == "yes"
51CFLAGS+=	-DLOADER_EXT2FS_SUPPORT
52.endif
53.if ${LOADER_NANDFS_SUPPORT} == "yes"
54CFLAGS+=	-DLOADER_NANDFS_SUPPORT
55.endif
56.if ${LOADER_GZIP_SUPPORT} == "yes"
57CFLAGS+=	-DLOADER_GZIP_SUPPORT
58.endif
59.if ${LOADER_BZIP2_SUPPORT} == "yes"
60CFLAGS+=	-DLOADER_BZIP2_SUPPORT
61.endif
62.if ${LOADER_NET_SUPPORT} == "yes"
63CFLAGS+=	-DLOADER_NET_SUPPORT
64.endif
65.if ${LOADER_NFS_SUPPORT} == "yes"
66CFLAGS+=	-DLOADER_NFS_SUPPORT
67.endif
68.if ${LOADER_TFTP_SUPPORT} == "yes"
69CFLAGS+=	-DLOADER_TFTP_SUPPORT
70.endif
71.if ${LOADER_FDT_SUPPORT} == "yes"
72CFLAGS+=	-I${.CURDIR}/../../fdt
73CFLAGS+=	-I${.OBJDIR}/../../fdt
74CFLAGS+=	-DLOADER_FDT_SUPPORT
75LIBUBOOT_FDT=	${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a
76LIBFDT=		${.OBJDIR}/../../fdt/libfdt.a
77.endif
78
79.if ${MK_FORTH} != "no"
80# Enable BootForth
81BOOT_FORTH=	yes
82CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/arm
83LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
84.endif
85
86# Always add MI sources
87.PATH:		${.CURDIR}/../../common
88.include	"${.CURDIR}/../../common/Makefile.inc"
89CFLAGS+=	-I${.CURDIR}/../../common
90CFLAGS+=	-I.
91
92CLEANFILES+=	vers.c loader.help
93
94CFLAGS+=	-ffreestanding -msoft-float
95
96LDFLAGS=	-nostdlib -static
97LDFLAGS+=	-T ldscript.generated
98LDFLAGS+=	-T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
99
100# Pull in common loader code
101.PATH:		${.CURDIR}/../../uboot/common
102.include	"${.CURDIR}/../../uboot/common/Makefile.inc"
103CFLAGS+=	-I${.CURDIR}/../../uboot/common
104
105# U-Boot standalone support library
106LIBUBOOT=	${.OBJDIR}/../../uboot/lib/libuboot.a
107CFLAGS+=	-I${.CURDIR}/../../uboot/lib
108CFLAGS+=	-I${.OBJDIR}/../../uboot/lib
109
110# where to get libstand from
111CFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
112
113# clang doesn't understand %D as a specifier to printf
114NO_WERROR.clang=
115
116DPADD=		${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
117LDADD=		${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
118
119vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
120	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
121
122loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
123	cat ${.ALLSRC} | \
124	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
125
126${PROG}: ldscript.generated ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
127
128ldscript.generated::
129	rm -f ldscript.generated.tmp
130	echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >ldscript.generated.tmp
131	if diff ldscript.generated ldscript.generated.tmp > /dev/null; then \
132		true; \
133	else \
134		rm -f ldscript.generated; \
135		mv ldscript.generated.tmp ldscript.generated; \
136	fi
137
138.if !defined(LOADER_ONLY)
139.PATH: ${.CURDIR}/../../forth
140FILES+=	loader.help loader.4th support.4th loader.conf
141FILES+=	screen.4th frames.4th beastie.4th
142FILES+=	brand.4th check-password.4th color.4th delay.4th
143FILES+=	menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
144FILESDIR_loader.conf=	/boot/defaults
145
146# Put sample loader.rc and menu.rc on disk but don't enable them
147# by default.
148FILES+=	loader.rc
149FILESNAME_loader.rc=	loader.rc.sample
150FILES+=	menu.rc
151FILESNAME_menu.rc=	menu.rc.sample
152.endif
153
154.include <bsd.prog.mk>
155