Makefile revision 125556
150477Speter# $FreeBSD: head/sys/boot/i386/loader/Makefile 125556 2004-02-07 08:10:07Z ru $
238465Smsmith
348351SpeterNEWVERSWHAT=	"bootstrap loader" i386
438465Smsmith
539441Smsmith# architecture-specific loader code
6125537SruSRCS=		main.c conf.c vers.c
739441Smsmith
896306SobrienCFLAGS+=	-ffreestanding
959087Sps# Enable PXE TFTP or NFS support, not both.
1068310Sps.if defined(LOADER_TFTP_SUPPORT)
1168310SpsCFLAGS+=	-DLOADER_TFTP_SUPPORT
1268310Sps.else
1359087SpsCFLAGS+=	-DLOADER_NFS_SUPPORT
1468310Sps.endif
1559087Sps
1639178Smsmith# Enable PnP and ISA-PnP code.
1740555SmsmithHAVE_PNP=	yes
1840555SmsmithHAVE_ISABUS=	yes
1939178Smsmith
2056992Sluigi.if !defined(NOFORTH)
2140877Smsmith# Enable BootForth
2256903SjhbBOOT_FORTH=	yes
2356903SjhbCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
2441107Sjkh.if exists(${.OBJDIR}/../../ficl/libficl.a)
2541107SjkhLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
2641107Sjkh.else
2741107SjkhLIBFICL=	${.CURDIR}/../../ficl/libficl.a
2841107Sjkh.endif
2956992Sluigi.endif
3040877Smsmith
3183616Ssobomax.if defined(LOADER_BZIP2_SUPPORT)
3283616SsobomaxCFLAGS+=	-DLOADER_BZIP2_SUPPORT
3383616Ssobomax.endif
3483616Ssobomax.if !defined(LOADER_NO_GZIP_SUPPORT)
3583616SsobomaxCFLAGS+=	-DLOADER_GZIP_SUPPORT
3683616Ssobomax.endif
3783616Ssobomax
3838465Smsmith# Always add MI sources 
3938465Smsmith.PATH:		${.CURDIR}/../../common
40125516Sru.include	"${.CURDIR}/../../common/Makefile.inc"
4140338SpeterCFLAGS+=	-I${.CURDIR}/../../common
42125537SruCFLAGS+=	-I.
4338465Smsmith
44125537SruCLEANFILES=	vers.c loader loader.list loader.bin loader.sym loader.help
4538465Smsmith
4638465SmsmithCFLAGS+=	-Wall
4744243SmsmithLDFLAGS=	-nostdlib -static -Ttext 0x0
4838465Smsmith
4938465Smsmith# i386 standalone support library
5038465SmsmithLIBI386=	${.OBJDIR}/../libi386/libi386.a
5138465SmsmithCFLAGS+=	-I${.CURDIR}/..
5238465Smsmith
5339441Smsmith# BTX components
5439646SpeterCFLAGS+=	-I${.CURDIR}/../btx/lib
5539441Smsmith
5639441Smsmith# BTX is expecting ELF components
5739441SmsmithCFLAGS+=	-elf
5839441Smsmith
5939664Smsmith# Debug me!
6040884Smsmith#CFLAGS+=	-g
6140884Smsmith#LDFLAGS+=	-g
6239664Smsmith
63125537Sru# Pick up ../Makefile.inc early.
64125537Sru.include <bsd.init.mk>
65125537Sru
66125537Sruvers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
6748351Speter	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
6838465Smsmith
69125537Sruloader: loader.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
70102623Sjhb	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
71125537Sru		-b ${BTXKERN} loader.bin
7242493Smsmith#	/usr/bin/kzip ${.TARGET}
7342493Smsmith#	mv ${.TARGET}.kz ${.TARGET}
7438465Smsmith
75125537Sruloader.bin: loader.sym
7640555Smsmith	cp ${.ALLSRC} ${.TARGET}
7769985Srnordier	strip -R .comment -R .note ${.TARGET}
7840555Smsmith
79125537Sruloader.help: help.common help.i386
8042807Smsmith	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
8141821Smsmith
8294956Sru.PATH: ${.CURDIR}/../../forth 
83125537SruFILES=	loader loader.help loader.4th support.4th loader.conf
84115410SscottlFILES+= screen.4th frames.4th beastie.4th
85125537Sru# XXX INSTALLFLAGS_loader= -b
86125537SruFILESMODE_loader= ${BINMODE} -b
8794956SruFILESDIR_loader.conf=	/boot/defaults
8894956Sru
8945759Sdcs.if !exists(${DESTDIR}/boot/loader.rc)
90115423SscottlFILES+=	${.CURDIR}/loader.rc
9145759Sdcs.endif
9241821Smsmith
93125537SruOBJS=	${SRCS:N*.h:R:S/$/.o/g}
9440555Smsmith
95125537Sruloader.sym: ${OBJS} ${LIBFICL} ${LIBI386} ${LIBSTAND}
96125537Sru	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} \
9798556Sphk		${LIBFICL} ${LIBI386} ${LIBSTAND}
9839441Smsmith
99125556Sru.if ${MACHINE_ARCH} == "amd64"
100125537Sru${OBJS}: machine
101125537SruCLEANFILES+=	machine
10240338Spetermachine:
10340338Speter	ln -sf ${.CURDIR}/../../../i386/include machine
10440555Smsmith.endif
10540555Smsmith
106125537Sru.include <bsd.prog.mk>
107