Makefile revision 83616
150477Speter# $FreeBSD: head/sys/boot/i386/loader/Makefile 83616 2001-09-18 14:52:36Z sobomax $
238465Smsmith
339441SmsmithBASE=		loader
458713SjhbPROG=		${BASE}
544780Sdcs#NOMAN=
639857SjkhSTRIP=
748351SpeterNEWVERSWHAT=	"bootstrap loader" i386
839851SpeterBINDIR?=	/boot
983368SruINSTALLFLAGS=	-b
1038465Smsmith
1139441Smsmith# architecture-specific loader code
1259473SpsSRCS=		main.c conf.c
1339441Smsmith
1459087Sps# Enable PXE TFTP or NFS support, not both.
1568310Sps.if defined(LOADER_TFTP_SUPPORT)
1668310SpsCFLAGS+=	-DLOADER_TFTP_SUPPORT
1768310Sps.else
1859087SpsCFLAGS+=	-DLOADER_NFS_SUPPORT
1968310Sps.endif
2059087Sps
2139178Smsmith# Enable PnP and ISA-PnP code.
2240555SmsmithHAVE_PNP=	yes
2340555SmsmithHAVE_ISABUS=	yes
2439178Smsmith
2556992Sluigi.if !defined(NOFORTH)
2640877Smsmith# Enable BootForth
2756903SjhbBOOT_FORTH=	yes
2856903SjhbCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
2941107Sjkh.if exists(${.OBJDIR}/../../ficl/libficl.a)
3041107SjkhLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
3141107Sjkh.else
3241107SjkhLIBFICL=	${.CURDIR}/../../ficl/libficl.a
3341107Sjkh.endif
3456992Sluigi.endif
3540877Smsmith
3683616Ssobomax.if defined(LOADER_BZIP2_SUPPORT)
3783616SsobomaxCFLAGS+=	-DLOADER_BZIP2_SUPPORT
3883616Ssobomax.endif
3983616Ssobomax.if !defined(LOADER_NO_GZIP_SUPPORT)
4083616SsobomaxCFLAGS+=	-DLOADER_GZIP_SUPPORT
4183616Ssobomax.endif
4283616Ssobomax
4338465Smsmith# Always add MI sources 
4438465Smsmith.PATH:		${.CURDIR}/../../common
4538465Smsmith.include	<${.CURDIR}/../../common/Makefile.inc>
4640338SpeterCFLAGS+=	-I${.CURDIR}/../../common
4740338SpeterCFLAGS+=	-I${.CURDIR}/../../.. -I.
4838465Smsmith
4941821SmsmithCLEANFILES+=	vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym ${BASE}.help
5038465Smsmith
5138465SmsmithCFLAGS+=	-Wall
5244243SmsmithLDFLAGS=	-nostdlib -static -Ttext 0x0
5338465Smsmith
5438465Smsmith# i386 standalone support library
5538465SmsmithLIBI386=	${.OBJDIR}/../libi386/libi386.a
5638465SmsmithCFLAGS+=	-I${.CURDIR}/..
5738465Smsmith
5839474Smsmith# where to get libstand from
5965598Simp#XXX need a better way to do this
6065598SimpLIBSTAND=	${.CURDIR}/../../../../lib/libstand/libstand.a
6165598Simp.if !exists(${LIBSTAND})
6265598SimpLIBSTAND=	${.OBJDIR}/../../../../lib/libstand/libstand.a
6365598Simp.if !exists(${LIBSTAND})
6439474SmsmithLIBSTAND=	-lstand
6565598Simp.endif
6665598Simp.endif
6759087SpsCFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
6839474Smsmith
6939441Smsmith# BTX components
7039646Speter.if exists(${.OBJDIR}/../btx)
7139646SpeterBTXDIR=		${.OBJDIR}/../btx
7239646Speter.else
7339441SmsmithBTXDIR=		${.CURDIR}/../btx
7439646Speter.endif
7539441SmsmithBTXLDR=		${BTXDIR}/btxldr/btxldr
7639441SmsmithBTXKERN=	${BTXDIR}/btx/btx
7739441SmsmithBTXCRT=		${BTXDIR}/lib/crt0.o
7839646SpeterCFLAGS+=	-I${.CURDIR}/../btx/lib
7939441Smsmith
8039441Smsmith# BTX is expecting ELF components
8139441SmsmithCFLAGS+=	-elf
8239441Smsmith
8339664Smsmith# Debug me!
8440884Smsmith#CFLAGS+=	-g
8540884Smsmith#LDFLAGS+=	-g
8639664Smsmith
8748351Spetervers.o:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
8848351Speter	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
8938465Smsmith	${CC} -c vers.c
9038465Smsmith
9142274Smsmith${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT} ${BASE}.help
9282133Speter	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
9358713Sjhb		-b ${BTXKERN} ${BASE}.bin
9442493Smsmith#	/usr/bin/kzip ${.TARGET}
9542493Smsmith#	mv ${.TARGET}.kz ${.TARGET}
9638465Smsmith
9740555Smsmith${BASE}.bin: ${BASE}.sym
9840555Smsmith	cp ${.ALLSRC} ${.TARGET}
9969985Srnordier	strip -R .comment -R .note ${.TARGET}
10040555Smsmith
10141821Smsmith${BASE}.help: help.common help.i386
10242807Smsmith	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
10341821Smsmith
10442268Smsmithbeforeinstall:
10542268Smsmith.if exists(${.OBJDIR}/loader.help)
10642268Smsmith	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
10742268Smsmith		${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
10842268Smsmith.else
10942268Smsmith	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
11042268Smsmith		${.CURDIR}/${BASE}.help ${DESTDIR}/boot
11142268Smsmith.endif
11245759Sdcs.if !exists(${DESTDIR}/boot/loader.rc)
11344622Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
11445759Sdcs		${.CURDIR}/../../forth/loader.rc ${DESTDIR}/boot
11545759Sdcs.endif
11645759Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
11744622Sdcs		${.CURDIR}/../../forth/loader.4th ${DESTDIR}/boot
11844622Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
11944622Sdcs		${.CURDIR}/../../forth/support.4th ${DESTDIR}/boot
12044622Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
12144622Sdcs		${.CURDIR}/../../forth/loader.conf ${DESTDIR}/boot/defaults
12241821Smsmith
12358713Sjhb.include <${.CURDIR}/../Makefile.inc>
12458713Sjhb
12540555Smsmith# Cannot use ${OBJS} above this line
12640555Smsmith.include <bsd.prog.mk>
12740555Smsmith
12840877Smsmith${BASE}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o
12940555Smsmith	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
13059473Sps		${LIBFICL} ${LIBI386} ${LIBSTAND}
13139441Smsmith
13240555Smsmith# If it's not there, don't consider it a target
13340555Smsmith.if exists(${.CURDIR}/../../../i386/include)
13440555Smsmithbeforedepend ${OBJS}: machine
13539441Smsmith
13640338Spetermachine:
13740338Speter	ln -sf ${.CURDIR}/../../../i386/include machine
13840338Speter
13940555Smsmith.endif
14040555Smsmith
14140338SpeterCLEANFILES+=	machine
142