Makefile revision 329011
190075Sobrien# $FreeBSD: stable/11/sys/boot/i386/loader/Makefile 329011 2018-02-08 02:50:47Z kevans $
290075Sobrien
390075Sobrien.include <src.opts.mk>
490075SobrienMK_SSP=		no
590075Sobrien
690075SobrienLOADER?=	loader
790075SobrienPROG=		${LOADER}.sym
890075SobrienMAN=	
990075SobrienINTERNALPROG=
1090075SobrienNEWVERSWHAT?=	"bootstrap loader" x86
1190075SobrienVERSION_FILE=	${.CURDIR}/../loader/version
1290075Sobrien
1390075Sobrien# architecture-specific loader code
1490075SobrienSRCS=		main.c conf.c vers.c
1590075Sobrien
1690075Sobrien# Put LOADER_FIREWIRE_SUPPORT=yes in /etc/make.conf for FireWire/dcons support
1790075Sobrien.if defined(LOADER_FIREWIRE_SUPPORT)
1890075SobrienCFLAGS+=	-DLOADER_FIREWIRE_SUPPORT
1990075SobrienLIBFIREWIRE=	${.OBJDIR}/../libfirewire/libfirewire.a
2090075Sobrien.endif
2190075Sobrien
2290075Sobrien# Set by zfsloader Makefile
2390075Sobrien.if defined(LOADER_ZFS_SUPPORT)
2490075SobrienCFLAGS+=	-DLOADER_ZFS_SUPPORT
2590075SobrienLIBZFSBOOT=	${.OBJDIR}/../../zfs/libzfsboot.a
2690075Sobrien.endif
2790075Sobrien
2890075Sobrien# Enable PXE TFTP or NFS support, not both.
2990075Sobrien.if defined(LOADER_TFTP_SUPPORT)
3090075SobrienCFLAGS+=	-DLOADER_TFTP_SUPPORT
3190075Sobrien.else
3290075SobrienCFLAGS+=	-DLOADER_NFS_SUPPORT
3390075Sobrien.endif
3490075Sobrien
3590075Sobrien# Include bcache code.
3690075SobrienHAVE_BCACHE=	yes
3790075Sobrien
3890075Sobrien# Enable PnP and ISA-PnP code.
3990075SobrienHAVE_PNP=	yes
4090075SobrienHAVE_ISABUS=	yes
4190075Sobrien
4290075Sobrien.if ${MK_FORTH} != "no"
4390075Sobrien# Enable BootForth
4490075SobrienBOOT_FORTH=	yes
4590075SobrienCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
4690075Sobrien.if ${MACHINE_CPUARCH} == "amd64"
4790075SobrienLIBFICL=	${.OBJDIR}/../../ficl32/libficl.a
4890075Sobrien.else
4990075SobrienLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
5090075Sobrien.endif
5190075Sobrien.endif
5290075Sobrien
5390075Sobrien.if defined(LOADER_BZIP2_SUPPORT)
5496263SobrienCFLAGS+=	-DLOADER_BZIP2_SUPPORT
5596263Sobrien.endif
5690075Sobrien.if !defined(LOADER_NO_GZIP_SUPPORT)
5790075SobrienCFLAGS+=	-DLOADER_GZIP_SUPPORT
5890075Sobrien.endif
5990075Sobrien.if defined(LOADER_NANDFS_SUPPORT)
6090075SobrienCFLAGS+=	-DLOADER_NANDFS_SUPPORT
6190075Sobrien.endif
6290075Sobrien.if !defined(LOADER_NO_GELI_SUPPORT)
6390075SobrienCFLAGS+=	-DLOADER_GELI_SUPPORT
6490075SobrienLIBGELIBOOT=	${.OBJDIR}/../../geli/libgeliboot.a
6590075Sobrien.PATH:		${.CURDIR}/../../../opencrypto
6690075SobrienSRCS+=		xform_aes_xts.c
6790075SobrienCFLAGS+=	-I${.CURDIR}/../../.. -D_STAND
6890075Sobrien.endif
6990075Sobrien
7090075Sobrien# Always add MI sources
7190075Sobrien.PATH:		${.CURDIR}/../../common
7290075Sobrien.include	"${.CURDIR}/../../common/Makefile.inc"
7390075SobrienCFLAGS+=	-I${.CURDIR}/../../common
7490075SobrienCFLAGS+=	-I.
7590075Sobrien
7690075SobrienCLEANFILES=	${LOADER} ${LOADER}.bin loader.help
7790075Sobrien
7890075SobrienCFLAGS+=	-Wall
7990075SobrienLDFLAGS=	-static -Ttext 0x0
8090075Sobrien
8190075Sobrien# i386 standalone support library
8290075SobrienLIBI386=	${.OBJDIR}/../libi386/libi386.a
8390075SobrienCFLAGS+=	-I${.CURDIR}/..
8490075Sobrien
8590075SobrienLIBSTAND=	${.OBJDIR}/../../libstand32/libstand.a
8690075Sobrien
8790075Sobrien# BTX components
8890075SobrienCFLAGS+=	-I${.CURDIR}/../btx/lib
8990075Sobrien
9090075Sobrien# Debug me!
9190075Sobrien#CFLAGS+=	-g
9290075Sobrien#LDFLAGS+=	-g
9390075Sobrien
9490075Sobrien# Pick up ../Makefile.inc early.
9590075Sobrien.include <bsd.init.mk>
9690075Sobrien
9790075Sobrien${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
9890075Sobrien	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
9990075Sobrien		-b ${BTXKERN} ${LOADER}.bin
10090075Sobrien
10190075Sobrien${LOADER}.bin: ${LOADER}.sym
10290075Sobrien	strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
10390075Sobrien
10490075Sobrienloader.help: help.common help.i386
10590075Sobrien	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
10690075Sobrien
10790075SobrienFILES=	${LOADER}
10890075Sobrien# XXX INSTALLFLAGS_loader= -b
10990075SobrienFILESMODE_${LOADER}= ${BINMODE} -b
11090075Sobrien
11190075Sobrien.if !defined(LOADER_ONLY)
11290075Sobrien.PATH: ${.CURDIR}/../../forth
11390075Sobrien.include	"${.CURDIR}/../../forth/Makefile.inc"
11496263SobrienFILES+=	pcibios.4th
11596263Sobrien
11690075SobrienFILES+=	loader.rc menu.rc
11790075Sobrien.endif
11890075Sobrien
11990075Sobrien# XXX crt0.o needs to be first for pxeboot(8) to work
12090075SobrienOBJS=	${BTXCRT}
12190075Sobrien
12290075SobrienDPADD=	${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSTAND}
12390075SobrienLDADD=	${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSTAND}
12490075Sobrien
12590075Sobrien.include <bsd.prog.mk>
12690075Sobrien
12790075Sobrien.if ${MACHINE_CPUARCH} == "amd64"
12890075Sobrienbeforedepend ${OBJS}: machine
12990075SobrienCLEANFILES+=	machine
13090075SobrienCFLAGS+=	-DLOADER_PREFER_AMD64
13190075Sobrienmachine: .NOMETA
13290075Sobrien	ln -sf ${.CURDIR}/../../../i386/include machine
13390075Sobrien.endif
13490075Sobrien