Makefile revision 246369
1166124Srafan# $FreeBSD: head/sys/boot/arm/uboot/Makefile 246369 2013-02-05 20:03:58Z andrew $
2166124Srafan
3166124Srafan.include <bsd.own.mk>
4166124Srafan
5166124SrafanPROG=		ubldr
6166124SrafanNEWVERSWHAT=	"U-Boot loader" ${MACHINE_ARCH}
7166124SrafanBINDIR?=	/boot
8166124SrafanINSTALLFLAGS=	-b
9166124SrafanWARNS?=		1
10166124Srafan# Address at which ubldr will be loaded.
11166124Srafan# This varies for different boards and SOCs.
12166124SrafanUBLDR_LOADADDR?=	0x1000000
13166124Srafan
14166124Srafan# Architecture-specific loader code
15166124SrafanSRCS=		start.S conf.c vers.c
16166124Srafan
17166124Srafan.if !defined(LOADER_NO_DISK_SUPPORT)
18166124SrafanLOADER_DISK_SUPPORT?=	yes
19166124Srafan.else
20166124SrafanLOADER_DISK_SUPPORT=	no
21166124Srafan.endif
22166124SrafanLOADER_UFS_SUPPORT?=	yes
23166124SrafanLOADER_CD9660_SUPPORT?=	no
24166124SrafanLOADER_EXT2FS_SUPPORT?=	no
25166124Srafan.if ${MK_NAND} != "no"
26166124SrafanLOADER_NANDFS_SUPPORT?= yes
2750276Speter.else
28166124SrafanLOADER_NANDFS_SUPPORT?= no
29166124Srafan.endif
3050276SpeterLOADER_NET_SUPPORT?=	yes
3150276SpeterLOADER_NFS_SUPPORT?=	yes
3250276SpeterLOADER_TFTP_SUPPORT?=	no
3350276SpeterLOADER_GZIP_SUPPORT?=	no
3450276SpeterLOADER_BZIP2_SUPPORT?=	no
3550276Speter.if ${MK_FDT} != "no"
3650276SpeterLOADER_FDT_SUPPORT=	yes
3750276Speter.else
3850276SpeterLOADER_FDT_SUPPORT=	no
3950276Speter.endif
4050276Speter
4166963Speter.if ${LOADER_DISK_SUPPORT} == "yes"
4250276SpeterCFLAGS+=	-DLOADER_DISK_SUPPORT
4350276Speter.endif
4450276Speter.if ${LOADER_UFS_SUPPORT} == "yes"
4550276SpeterCFLAGS+=	-DLOADER_UFS_SUPPORT
4650276Speter.endif
4750276Speter.if ${LOADER_CD9660_SUPPORT} == "yes"
4850276SpeterCFLAGS+=	-DLOADER_CD9660_SUPPORT
4950276Speter.endif
5050276Speter.if ${LOADER_EXT2FS_SUPPORT} == "yes"
5150276SpeterCFLAGS+=	-DLOADER_EXT2FS_SUPPORT
5250276Speter.endif
5350276Speter.if ${LOADER_NANDFS_SUPPORT} == "yes"
5450276SpeterCFLAGS+=	-DLOADER_NANDFS_SUPPORT
5550276Speter.endif
5650276Speter.if ${LOADER_GZIP_SUPPORT} == "yes"
5750276SpeterCFLAGS+=	-DLOADER_GZIP_SUPPORT
5850276Speter.endif
5950276Speter.if ${LOADER_BZIP2_SUPPORT} == "yes"
6050276SpeterCFLAGS+=	-DLOADER_BZIP2_SUPPORT
6150276Speter.endif
6250276Speter.if ${LOADER_NET_SUPPORT} == "yes"
6350276SpeterCFLAGS+=	-DLOADER_NET_SUPPORT
6450276Speter.endif
6550276Speter.if ${LOADER_NFS_SUPPORT} == "yes"
6650276SpeterCFLAGS+=	-DLOADER_NFS_SUPPORT
6750276Speter.endif
6850276Speter.if ${LOADER_TFTP_SUPPORT} == "yes"
6950276SpeterCFLAGS+=	-DLOADER_TFTP_SUPPORT
7050276Speter.endif
7150276Speter.if ${LOADER_FDT_SUPPORT} == "yes"
7250276SpeterCFLAGS+=	-I${.CURDIR}/../../fdt
7350276SpeterCFLAGS+=	-I${.OBJDIR}/../../fdt
7450276SpeterCFLAGS+=	-DLOADER_FDT_SUPPORT
7550276SpeterLIBFDT=		${.OBJDIR}/../../fdt/libfdt.a
7650276Speter.endif
7750276Speter
7850276Speter.if !defined(NO_FORTH)
7950276Speter# Enable BootForth
8050276SpeterBOOT_FORTH=	yes
8150276SpeterCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/arm
8250276SpeterLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
8350276Speter.endif
8450276Speter
8550276Speter# Always add MI sources
8650276Speter.PATH:		${.CURDIR}/../../common
8750276Speter.include	"${.CURDIR}/../../common/Makefile.inc"
8850276SpeterCFLAGS+=	-I${.CURDIR}/../../common
8950276SpeterCFLAGS+=	-I.
9050276Speter
9150276SpeterCLEANFILES+=	vers.c loader.help
9250276Speter
9350276SpeterCFLAGS+=	-ffreestanding
9450276Speter
9550276SpeterLDFLAGS=	-nostdlib -static
9650276SpeterLDFLAGS+=	-T ldscript.generated
9750276SpeterLDFLAGS+=	-T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
9850276Speter
9950276Speter# Pull in common loader code
10050276Speter.PATH:		${.CURDIR}/../../uboot/common
10150276Speter.include	"${.CURDIR}/../../uboot/common/Makefile.inc"
10250276SpeterCFLAGS+=	-I${.CURDIR}/../../uboot/common
10350276Speter
10450276Speter# U-Boot standalone support library
10550276SpeterLIBUBOOT=	${.OBJDIR}/../../uboot/lib/libuboot.a
10650276SpeterCFLAGS+=	-I${.CURDIR}/../../uboot/lib
10750276SpeterCFLAGS+=	-I${.OBJDIR}/../../uboot/lib
10850276Speter
10950276Speter# where to get libstand from
11050276SpeterCFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
11150276Speter
11250276Speter# clang doesn't understand %D as a specifier to printf
11350276SpeterNO_WERROR.clang=
11450276Speter
11550276SpeterDPADD=		${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND}
11650276SpeterLDADD=		${LIBFICL} ${LIBUBOOT} ${LIBFDT} -lstand
11750276Speter
11850276Spetervers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
11950276Speter	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
12050276Speter
12150276Speterloader.help: help.common help.uboot
12250276Speter	cat ${.ALLSRC} | \
12350276Speter	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
12450276Speter
12550276Speter${PROG}: ldscript.generated ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
12650276Speter
12750276Speterldscript.generated::
12850276Speter	rm -f ldscript.generated.tmp
12950276Speter	echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >ldscript.generated.tmp
13050276Speter	if diff ldscript.generated ldscript.generated.tmp > /dev/null; then \
13150276Speter		true; \
13250276Speter	else \
13350276Speter		rm -f ldscript.generated; \
13450276Speter		mv ldscript.generated.tmp ldscript.generated; \
13550276Speter	fi
13650276Speter
13750276Speter.PATH: ${.CURDIR}/../../forth
13850276SpeterFILES=	loader.help
13950276Speter
14050276Speter.include <bsd.prog.mk>
14150276Speter