Makefile revision 42493
142493Smsmith# $Id: Makefile,v 1.25 1999/01/09 20:14:46 msmith Exp $
238465Smsmith
339441SmsmithBASE=		loader
439441SmsmithPROG=		${BASE}
538465SmsmithNOMAN=
639857SjkhSTRIP=
738465SmsmithNEWVERSWHAT=	"bootstrap loader"
839851SpeterBINDIR?=	/boot
938465Smsmith
1039441Smsmith# architecture-specific loader code
1139441SmsmithSRCS=		main.c conf.c
1239441Smsmith
1339178Smsmith# Enable PnP and ISA-PnP code.
1440555SmsmithHAVE_PNP=	yes
1540555SmsmithHAVE_ISABUS=	yes
1639178Smsmith
1740877Smsmith# Enable BootForth
1841107SjkhBOOT_FORTH=	yes
1941107SjkhCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl
2041107Sjkh.if exists(${.OBJDIR}/../../ficl/libficl.a)
2141107SjkhLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
2241107Sjkh.else
2341107SjkhLIBFICL=	${.CURDIR}/../../ficl/libficl.a
2441107Sjkh.endif
2540877Smsmith
2638465Smsmith# Always add MI sources 
2738465Smsmith.PATH:		${.CURDIR}/../../common
2838465Smsmith.include	<${.CURDIR}/../../common/Makefile.inc>
2940338SpeterCFLAGS+=	-I${.CURDIR}/../../common
3040338SpeterCFLAGS+=	-I${.CURDIR}/../../.. -I.
3138465Smsmith
3241821SmsmithCLEANFILES+=	vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym ${BASE}.help
3338465Smsmith
3438465SmsmithCFLAGS+=	-Wall
3539441SmsmithLDFLAGS=	-nostdlib -static -Ttext 0x1000
3638465Smsmith
3738465Smsmith# i386 standalone support library
3838465SmsmithLIBI386=	${.OBJDIR}/../libi386/libi386.a
3938465SmsmithCFLAGS+=	-I${.CURDIR}/..
4038465Smsmith
4139474Smsmith# where to get libstand from
4239474SmsmithLIBSTAND=	-lstand
4339474Smsmith#LIBSTAND=	${.CURDIR}/../../../lib/libstand/libstand.a
4439664Smsmith#CFLAGS+=	-I${.CURDIR}/../../../lib/libstand/
4539474Smsmith
4639441Smsmith# BTX components
4739646Speter.if exists(${.OBJDIR}/../btx)
4839646SpeterBTXDIR=		${.OBJDIR}/../btx
4939646Speter.else
5039441SmsmithBTXDIR=		${.CURDIR}/../btx
5139646Speter.endif
5239441SmsmithBTXLDR=		${BTXDIR}/btxldr/btxldr
5339441SmsmithBTXKERN=	${BTXDIR}/btx/btx
5439441SmsmithBTXCRT=		${BTXDIR}/lib/crt0.o
5539646SpeterCFLAGS+=	-I${.CURDIR}/../btx/lib
5639441Smsmith
5739441Smsmith# BTX is expecting ELF components
5839441SmsmithCFLAGS+=	-elf
5939441Smsmith
6040555Smsmith# New linker set code
6140555SmsmithCFLAGS+=	-DNEW_LINKER_SET
6240555Smsmith
6339664Smsmith# Debug me!
6440884Smsmith#CFLAGS+=	-g
6540884Smsmith#LDFLAGS+=	-g
6639664Smsmith
6738465Smsmithvers.o:
6838465Smsmith	sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
6938465Smsmith	${CC} -c vers.c
7038465Smsmith
7142274Smsmith${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT} ${BASE}.help
7239450Smsmith	btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
7339450Smsmith		${BASE}.bin
7442493Smsmith#	/usr/bin/kzip ${.TARGET}
7542493Smsmith#	mv ${.TARGET}.kz ${.TARGET}
7638465Smsmith
7740555Smsmith${BASE}.bin: ${BASE}.sym
7840555Smsmith	cp ${.ALLSRC} ${.TARGET}
7940555Smsmith	strip ${.TARGET}
8040555Smsmith
8141821Smsmith${BASE}.help: help.common help.i386
8241821Smsmith	perl ${.CURDIR}/../../common/merge_help.pl ${.ALLSRC} > ${.TARGET}
8341821Smsmith
8442268Smsmithbeforeinstall:
8542268Smsmith.if exists(${.OBJDIR}/loader.help)
8642268Smsmith	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8742268Smsmith		${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
8842268Smsmith.else
8942268Smsmith	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
9042268Smsmith		${.CURDIR}/${BASE}.help ${DESTDIR}/boot
9142268Smsmith.endif
9241821Smsmith
9340555Smsmith# Cannot use ${OBJS} above this line
9440555Smsmith.include <bsd.prog.mk>
9540555Smsmith
9640877Smsmith${BASE}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o
9740555Smsmith	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
9840877Smsmith		${LIBFICL} ${LIBSTAND} ${LIBI386} ${LIBSTAND}
9939441Smsmith
10040555Smsmith# If it's not there, don't consider it a target
10140555Smsmith.if exists(${.CURDIR}/../../../i386/include)
10240555Smsmithbeforedepend ${OBJS}: machine
10339441Smsmith
10440338Spetermachine:
10540338Speter	ln -sf ${.CURDIR}/../../../i386/include machine
10640338Speter
10740555Smsmith.endif
10840555Smsmith
10940338SpeterCLEANFILES+=	machine
11040338Speter
11139441Smsmith
112