Makefile revision 189588
150477Speter# $FreeBSD: head/sys/boot/i386/loader/Makefile 189588 2009-03-09 17:16:29Z jhb $
238465Smsmith
3156813Sru.include <bsd.own.mk>
4188895SruMK_SSP=		no
5156813Sru
6125621SruPROG=		loader.sym
7125621SruINTERNALPROG=
848351SpeterNEWVERSWHAT=	"bootstrap loader" i386
938465Smsmith
1039441Smsmith# architecture-specific loader code
11125537SruSRCS=		main.c conf.c vers.c
1239441Smsmith
13170101Ssimokawa# Put LOADER_FIREWIRE_SUPPORT=yes in /etc/make.conf for FireWire/dcons support
14170101Ssimokawa.if defined(LOADER_FIREWIRE_SUPPORT)
15170101SsimokawaCFLAGS+=	-DLOADER_FIREWIRE_SUPPORT
16170101SsimokawaLIBFIREWIRE=	${.OBJDIR}/../libfirewire/libfirewire.a
17170101Ssimokawa.endif
18170101Ssimokawa
19185029Spjd# Put LOADER_ZFS_SUPPORT=yes in /etc/make.conf for ZFS support
20185029Spjd.if defined(LOADER_ZFS_SUPPORT)
21185029SpjdCFLAGS+=	-DLOADER_ZFS_SUPPORT
22185029SpjdLIBZFS=		${.OBJDIR}/../../zfs/libzfsboot.a
23185045Sache.else
24185045SacheLIBZFS=
25185029Spjd.endif
26185029Spjd
2759087Sps# Enable PXE TFTP or NFS support, not both.
2868310Sps.if defined(LOADER_TFTP_SUPPORT)
2968310SpsCFLAGS+=	-DLOADER_TFTP_SUPPORT
3068310Sps.else
3159087SpsCFLAGS+=	-DLOADER_NFS_SUPPORT
3268310Sps.endif
3359087Sps
34163893Smarcel# Include bcache code.
35163893SmarcelHAVE_BCACHE=	yes
36163893Smarcel
3739178Smsmith# Enable PnP and ISA-PnP code.
3840555SmsmithHAVE_PNP=	yes
3940555SmsmithHAVE_ISABUS=	yes
4039178Smsmith
41156813Sru.if ${MK_FORTH} != "no"
4240877Smsmith# Enable BootForth
4356903SjhbBOOT_FORTH=	yes
4456903SjhbCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
4541107SjkhLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
4641107Sjkh.endif
4740877Smsmith
48146874Sobrien.if defined(LOADER_BZIP2_SUPPORT)
4983616SsobomaxCFLAGS+=	-DLOADER_BZIP2_SUPPORT
5083616Ssobomax.endif
5183616Ssobomax.if !defined(LOADER_NO_GZIP_SUPPORT)
5283616SsobomaxCFLAGS+=	-DLOADER_GZIP_SUPPORT
5383616Ssobomax.endif
54189588Sjhb.if !defined(LOADER_NO_GPT_SUPPORT)
55189588SjhbCFLAGS+=	-DLOADER_GPT_SUPPORT
56189588Sjhb.endif
5783616Ssobomax
5838465Smsmith# Always add MI sources 
5938465Smsmith.PATH:		${.CURDIR}/../../common
60125516Sru.include	"${.CURDIR}/../../common/Makefile.inc"
6140338SpeterCFLAGS+=	-I${.CURDIR}/../../common
62125537SruCFLAGS+=	-I.
6338465Smsmith
64125751SruCLEANFILES=	vers.c loader loader.bin loader.help
6538465Smsmith
6638465SmsmithCFLAGS+=	-Wall
67125621SruLDFLAGS=	-static -Ttext 0x0
6838465Smsmith
6938465Smsmith# i386 standalone support library
7038465SmsmithLIBI386=	${.OBJDIR}/../libi386/libi386.a
7138465SmsmithCFLAGS+=	-I${.CURDIR}/..
7238465Smsmith
7339441Smsmith# BTX components
7439646SpeterCFLAGS+=	-I${.CURDIR}/../btx/lib
7539441Smsmith
7639664Smsmith# Debug me!
7740884Smsmith#CFLAGS+=	-g
7840884Smsmith#LDFLAGS+=	-g
7939664Smsmith
80125537Sru# Pick up ../Makefile.inc early.
81125537Sru.include <bsd.init.mk>
82125537Sru
83125537Sruvers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
8448351Speter	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
8538465Smsmith
86125621Sruloader: loader.bin ${BTXLDR} ${BTXKERN}
87102623Sjhb	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
88125537Sru		-b ${BTXKERN} loader.bin
8938465Smsmith
90125537Sruloader.bin: loader.sym
9140555Smsmith	cp ${.ALLSRC} ${.TARGET}
9269985Srnordier	strip -R .comment -R .note ${.TARGET}
9340555Smsmith
94125537Sruloader.help: help.common help.i386
9542807Smsmith	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
9641821Smsmith
9794956Sru.PATH: ${.CURDIR}/../../forth 
98125537SruFILES=	loader loader.help loader.4th support.4th loader.conf
99151874SscottlFILES+= screen.4th frames.4th beastie.4th
100125537Sru# XXX INSTALLFLAGS_loader= -b
101125537SruFILESMODE_loader= ${BINMODE} -b
10294956SruFILESDIR_loader.conf=	/boot/defaults
10394956Sru
10445759Sdcs.if !exists(${DESTDIR}/boot/loader.rc)
105138186SruFILES+=	loader.rc
10645759Sdcs.endif
10741821Smsmith
108126312Sru# XXX crt0.o needs to be first for pxeboot(8) to work
109126312SruOBJS=	${BTXCRT} 
11040555Smsmith
111185029SpjdDPADD=	${LIBFICL} ${LIBFIREWIRE} ${LIBZFS} ${LIBI386} ${LIBSTAND}
112185029SpjdLDADD=	${LIBFICL} ${LIBFIREWIRE} ${LIBZFS} ${LIBI386} -lstand
113126312Sru
114125621Sru.include <bsd.prog.mk>
11539441Smsmith
116125556Sru.if ${MACHINE_ARCH} == "amd64"
117125581Srubeforedepend ${OBJS}: machine
118125537SruCLEANFILES+=	machine
11940338Spetermachine:
12040338Speter	ln -sf ${.CURDIR}/../../../i386/include machine
12140555Smsmith.endif
122