Makefile revision 222417
150477Speter# $FreeBSD: head/sys/boot/i386/loader/Makefile 222417 2011-05-28 08:50:38Z julian $
238465Smsmith
3156813Sru.include <bsd.own.mk>
4188895SruMK_SSP=		no
5156813Sru
6199714SrnolandLOADER?=	loader
7199714SrnolandPROG=		${LOADER}.sym
8125621SruINTERNALPROG=
9212066SdelphijNEWVERSWHAT?=	"bootstrap loader" x86
1038465Smsmith
1139441Smsmith# architecture-specific loader code
12125537SruSRCS=		main.c conf.c vers.c
1339441Smsmith
14170101Ssimokawa# Put LOADER_FIREWIRE_SUPPORT=yes in /etc/make.conf for FireWire/dcons support
15170101Ssimokawa.if defined(LOADER_FIREWIRE_SUPPORT)
16170101SsimokawaCFLAGS+=	-DLOADER_FIREWIRE_SUPPORT
17170101SsimokawaLIBFIREWIRE=	${.OBJDIR}/../libfirewire/libfirewire.a
18170101Ssimokawa.endif
19170101Ssimokawa
20199714Srnoland# Set by zfsloader Makefile
21185029Spjd.if defined(LOADER_ZFS_SUPPORT)
22185029SpjdCFLAGS+=	-DLOADER_ZFS_SUPPORT
23185029SpjdLIBZFS=		${.OBJDIR}/../../zfs/libzfsboot.a
24185045Sache.else
25185045SacheLIBZFS=
26185029Spjd.endif
27185029Spjd
2859087Sps# Enable PXE TFTP or NFS support, not both.
2968310Sps.if defined(LOADER_TFTP_SUPPORT)
3068310SpsCFLAGS+=	-DLOADER_TFTP_SUPPORT
3168310Sps.else
3259087SpsCFLAGS+=	-DLOADER_NFS_SUPPORT
3368310Sps.endif
3459087Sps
35163893Smarcel# Include bcache code.
36163893SmarcelHAVE_BCACHE=	yes
37163893Smarcel
3839178Smsmith# Enable PnP and ISA-PnP code.
3940555SmsmithHAVE_PNP=	yes
4040555SmsmithHAVE_ISABUS=	yes
4139178Smsmith
42156813Sru.if ${MK_FORTH} != "no"
4340877Smsmith# Enable BootForth
4456903SjhbBOOT_FORTH=	yes
4556903SjhbCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
4641107SjkhLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
4741107Sjkh.endif
4840877Smsmith
49146874Sobrien.if defined(LOADER_BZIP2_SUPPORT)
5083616SsobomaxCFLAGS+=	-DLOADER_BZIP2_SUPPORT
5183616Ssobomax.endif
5283616Ssobomax.if !defined(LOADER_NO_GZIP_SUPPORT)
5383616SsobomaxCFLAGS+=	-DLOADER_GZIP_SUPPORT
5483616Ssobomax.endif
55189588Sjhb.if !defined(LOADER_NO_GPT_SUPPORT)
56189588SjhbCFLAGS+=	-DLOADER_GPT_SUPPORT
57189588Sjhb.endif
5883616Ssobomax
5938465Smsmith# Always add MI sources 
6038465Smsmith.PATH:		${.CURDIR}/../../common
61125516Sru.include	"${.CURDIR}/../../common/Makefile.inc"
6240338SpeterCFLAGS+=	-I${.CURDIR}/../../common
63125537SruCFLAGS+=	-I.
6438465Smsmith
65199714SrnolandCLEANFILES=	vers.c ${LOADER} ${LOADER}.bin loader.help
6638465Smsmith
6738465SmsmithCFLAGS+=	-Wall
68125621SruLDFLAGS=	-static -Ttext 0x0
6938465Smsmith
7038465Smsmith# i386 standalone support library
7138465SmsmithLIBI386=	${.OBJDIR}/../libi386/libi386.a
7238465SmsmithCFLAGS+=	-I${.CURDIR}/..
7338465Smsmith
7439441Smsmith# BTX components
7539646SpeterCFLAGS+=	-I${.CURDIR}/../btx/lib
7639441Smsmith
7739664Smsmith# Debug me!
7840884Smsmith#CFLAGS+=	-g
7940884Smsmith#LDFLAGS+=	-g
8039664Smsmith
81125537Sru# Pick up ../Makefile.inc early.
82125537Sru.include <bsd.init.mk>
83125537Sru
84199714Srnolandvers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version
85199714Srnoland	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \
86199714Srnoland		${NEWVERSWHAT}
8738465Smsmith
88199714Srnoland${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
89102623Sjhb	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
90199714Srnoland		-b ${BTXKERN} ${LOADER}.bin
9138465Smsmith
92199714Srnoland${LOADER}.bin: ${LOADER}.sym
9340555Smsmith	cp ${.ALLSRC} ${.TARGET}
9469985Srnordier	strip -R .comment -R .note ${.TARGET}
9540555Smsmith
96125537Sruloader.help: help.common help.i386
9742807Smsmith	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
9841821Smsmith
99199714SrnolandFILES=	${LOADER}
100199714Srnoland# XXX INSTALLFLAGS_loader= -b
101199714SrnolandFILESMODE_${LOADER}= ${BINMODE} -b
102199714Srnoland
103199714Srnoland.if !defined(LOADER_ONLY)
10494956Sru.PATH: ${.CURDIR}/../../forth 
105199714SrnolandFILES+=	loader.help loader.4th support.4th loader.conf
106151874SscottlFILES+= screen.4th frames.4th beastie.4th
107222417SjulianFILES+= brand.4th check-password.4th color.4th delay.4th
108222417SjulianFILES+= menu.4th menu-commands.4th shortcuts.4th version.4th
10994956SruFILESDIR_loader.conf=	/boot/defaults
11094956Sru
11145759Sdcs.if !exists(${DESTDIR}/boot/loader.rc)
112138186SruFILES+=	loader.rc
11345759Sdcs.endif
114222417Sjulian.if !exists(${DESTDIR}/boot/menu.rc)
115222417SjulianFILES+= menu.rc
116199714Srnoland.endif
117222417Sjulian.endif
11841821Smsmith
119126312Sru# XXX crt0.o needs to be first for pxeboot(8) to work
120126312SruOBJS=	${BTXCRT} 
12140555Smsmith
122185029SpjdDPADD=	${LIBFICL} ${LIBFIREWIRE} ${LIBZFS} ${LIBI386} ${LIBSTAND}
123210387SrpauloLDADD=	${LIBFICL} ${LIBFIREWIRE} ${LIBZFS} ${LIBI386} ${LIBSTAND}
124126312Sru
125125621Sru.include <bsd.prog.mk>
12639441Smsmith
127211677Simp.if ${MACHINE_CPUARCH} == "amd64"
128125581Srubeforedepend ${OBJS}: machine
129125537SruCLEANFILES+=	machine
13040338Spetermachine:
13140338Speter	ln -sf ${.CURDIR}/../../../i386/include machine
13240555Smsmith.endif
133