Makefile revision 311220
1162856Sdes# $FreeBSD: stable/11/sys/boot/i386/loader/Makefile 311220 2017-01-04 01:23:15Z emaste $
2162856Sdes
376259Sgreen.include <src.opts.mk>
465668SkrisMK_SSP=		no
565668Skris
665668SkrisLOADER?=	loader
765668SkrisPROG=		${LOADER}.sym
865668SkrisMAN=	
965668SkrisINTERNALPROG=
1065668SkrisNEWVERSWHAT?=	"bootstrap loader" x86
1165668Skris
1265668Skris# architecture-specific loader code
1365668SkrisSRCS=		main.c conf.c vers.c
1465668Skris
1565668Skris# Put LOADER_FIREWIRE_SUPPORT=yes in /etc/make.conf for FireWire/dcons support
1665668Skris.if defined(LOADER_FIREWIRE_SUPPORT)
1765668SkrisCFLAGS+=	-DLOADER_FIREWIRE_SUPPORT
1865668SkrisLIBFIREWIRE=	${.OBJDIR}/../libfirewire/libfirewire.a
1965668Skris.endif
2065668Skris
2165668Skris# Set by zfsloader Makefile
2265668Skris.if defined(LOADER_ZFS_SUPPORT)
2365668SkrisCFLAGS+=	-DLOADER_ZFS_SUPPORT
2465668SkrisLIBZFSBOOT=	${.OBJDIR}/../../zfs/libzfsboot.a
2565668Skris.endif
2665668Skris
27162856Sdes# Enable PXE TFTP or NFS support, not both.
28162856Sdes.if defined(LOADER_TFTP_SUPPORT)
29162856SdesCFLAGS+=	-DLOADER_TFTP_SUPPORT
30162856Sdes.else
31162856SdesCFLAGS+=	-DLOADER_NFS_SUPPORT
32162856Sdes.endif
33162856Sdes
34137019Sdes# Include bcache code.
35137019SdesHAVE_BCACHE=	yes
36162856Sdes
37162856Sdes# Enable PnP and ISA-PnP code.
38162856SdesHAVE_PNP=	yes
39162856SdesHAVE_ISABUS=	yes
40162856Sdes
41162856Sdes.if ${MK_FORTH} != "no"
42162856Sdes# Enable BootForth
43162856SdesBOOT_FORTH=	yes
4499048SdesCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
4569587Sgreen.if ${MACHINE_CPUARCH} == "amd64"
46149753SdesLIBFICL=	${.OBJDIR}/../../ficl32/libficl.a
47149753Sdes.else
48124211SdesLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
49124211Sdes.endif
5076259Sgreen.endif
5176259Sgreen
5276259Sgreen.if defined(LOADER_BZIP2_SUPPORT)
5376259SgreenCFLAGS+=	-DLOADER_BZIP2_SUPPORT
54149753Sdes.endif
5560573Skris.if !defined(LOADER_NO_GZIP_SUPPORT)
5660573SkrisCFLAGS+=	-DLOADER_GZIP_SUPPORT
5760573Skris.endif
5861209Skris.if defined(LOADER_NANDFS_SUPPORT)
5960573SkrisCFLAGS+=	-DLOADER_NANDFS_SUPPORT
6060573Skris.endif
6160573Skris.if !defined(LOADER_NO_GELI_SUPPORT)
6260573SkrisCFLAGS+=	-DLOADER_GELI_SUPPORT
6360573SkrisLIBGELIBOOT=	${.OBJDIR}/../../geli/libgeliboot.a
6460573Skris.PATH:		${.CURDIR}/../../../opencrypto
6560573SkrisSRCS+=		xform_aes_xts.c
6660573SkrisCFLAGS+=	-I${.CURDIR}/../../.. -D_STAND
6760573Skris.endif
6860573Skris
6960573Skris# Always add MI sources
70.PATH:		${.CURDIR}/../../common
71.include	"${.CURDIR}/../../common/Makefile.inc"
72CFLAGS+=	-I${.CURDIR}/../../common
73CFLAGS+=	-I.
74
75CLEANFILES=	vers.c ${LOADER} ${LOADER}.bin loader.help
76
77CFLAGS+=	-Wall
78LDFLAGS=	-static -Ttext 0x0
79
80# i386 standalone support library
81LIBI386=	${.OBJDIR}/../libi386/libi386.a
82CFLAGS+=	-I${.CURDIR}/..
83
84LIBSTAND=	${.OBJDIR}/../../libstand32/libstand.a
85
86# BTX components
87CFLAGS+=	-I${.CURDIR}/../btx/lib
88
89# Debug me!
90#CFLAGS+=	-g
91#LDFLAGS+=	-g
92
93# Pick up ../Makefile.inc early.
94.include <bsd.init.mk>
95
96vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version
97	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \
98		${NEWVERSWHAT}
99
100${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
101	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
102		-b ${BTXKERN} ${LOADER}.bin
103
104${LOADER}.bin: ${LOADER}.sym
105	strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
106
107loader.help: help.common help.i386
108	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
109
110FILES=	${LOADER}
111# XXX INSTALLFLAGS_loader= -b
112FILESMODE_${LOADER}= ${BINMODE} -b
113
114.if !defined(LOADER_ONLY)
115.PATH: ${.CURDIR}/../../forth
116.include	"${.CURDIR}/../../forth/Makefile.inc"
117FILES+=	pcibios.4th
118
119FILES+=	loader.rc menu.rc
120.endif
121
122# XXX crt0.o needs to be first for pxeboot(8) to work
123OBJS=	${BTXCRT}
124
125DPADD=	${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} ${LIBGELIBOOT}
126LDADD=	${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} ${LIBGELIBOOT}
127
128.include <bsd.prog.mk>
129
130.if ${MACHINE_CPUARCH} == "amd64"
131beforedepend ${OBJS}: machine
132CLEANFILES+=	machine
133CFLAGS+=	-DLOADER_PREFER_AMD64
134machine: .NOMETA
135	ln -sf ${.CURDIR}/../../../i386/include machine
136.endif
137