Makefile revision 48351
148351Speter# $Id: Makefile,v 1.34 1999/04/24 17:49:47 dcs Exp $
238465Smsmith
339441SmsmithBASE=		loader
439441SmsmithPROG=		${BASE}
546009SdcsMAN5=		../../forth/loader.conf.5
646005SdcsMAN8=		loader.8 ../../forth/loader.4th.8
744780Sdcs#NOMAN=
839857SjkhSTRIP=
948351SpeterNEWVERSWHAT=	"bootstrap loader" i386
1039851SpeterBINDIR?=	/boot
1138465Smsmith
1239441Smsmith# architecture-specific loader code
1339441SmsmithSRCS=		main.c conf.c
1439441Smsmith
1539178Smsmith# Enable PnP and ISA-PnP code.
1640555SmsmithHAVE_PNP=	yes
1740555SmsmithHAVE_ISABUS=	yes
1839178Smsmith
1940877Smsmith# Enable BootForth
2041107SjkhBOOT_FORTH=	yes
2141107SjkhCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl
2241107Sjkh.if exists(${.OBJDIR}/../../ficl/libficl.a)
2341107SjkhLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
2441107Sjkh.else
2541107SjkhLIBFICL=	${.CURDIR}/../../ficl/libficl.a
2641107Sjkh.endif
2740877Smsmith
2838465Smsmith# Always add MI sources 
2938465Smsmith.PATH:		${.CURDIR}/../../common
3038465Smsmith.include	<${.CURDIR}/../../common/Makefile.inc>
3140338SpeterCFLAGS+=	-I${.CURDIR}/../../common
3240338SpeterCFLAGS+=	-I${.CURDIR}/../../.. -I.
3338465Smsmith
3441821SmsmithCLEANFILES+=	vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym ${BASE}.help
3538465Smsmith
3638465SmsmithCFLAGS+=	-Wall
3744243SmsmithLDFLAGS=	-nostdlib -static -Ttext 0x0
3838465Smsmith
3938465Smsmith# i386 standalone support library
4038465SmsmithLIBI386=	${.OBJDIR}/../libi386/libi386.a
4138465SmsmithCFLAGS+=	-I${.CURDIR}/..
4238465Smsmith
4339474Smsmith# where to get libstand from
4439474SmsmithLIBSTAND=	-lstand
4539474Smsmith#LIBSTAND=	${.CURDIR}/../../../lib/libstand/libstand.a
4639664Smsmith#CFLAGS+=	-I${.CURDIR}/../../../lib/libstand/
4739474Smsmith
4839441Smsmith# BTX components
4939646Speter.if exists(${.OBJDIR}/../btx)
5039646SpeterBTXDIR=		${.OBJDIR}/../btx
5139646Speter.else
5239441SmsmithBTXDIR=		${.CURDIR}/../btx
5339646Speter.endif
5439441SmsmithBTXLDR=		${BTXDIR}/btxldr/btxldr
5539441SmsmithBTXKERN=	${BTXDIR}/btx/btx
5639441SmsmithBTXCRT=		${BTXDIR}/lib/crt0.o
5739646SpeterCFLAGS+=	-I${.CURDIR}/../btx/lib
5839441Smsmith
5939441Smsmith# BTX is expecting ELF components
6039441SmsmithCFLAGS+=	-elf
6139441Smsmith
6240555Smsmith# New linker set code
6340555SmsmithCFLAGS+=	-DNEW_LINKER_SET
6440555Smsmith
6539664Smsmith# Debug me!
6640884Smsmith#CFLAGS+=	-g
6740884Smsmith#LDFLAGS+=	-g
6839664Smsmith
6948351Spetervers.o:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
7048351Speter	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
7138465Smsmith	${CC} -c vers.c
7238465Smsmith
7342274Smsmith${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT} ${BASE}.help
7439450Smsmith	btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
7539450Smsmith		${BASE}.bin
7642493Smsmith#	/usr/bin/kzip ${.TARGET}
7742493Smsmith#	mv ${.TARGET}.kz ${.TARGET}
7838465Smsmith
7940555Smsmith${BASE}.bin: ${BASE}.sym
8040555Smsmith	cp ${.ALLSRC} ${.TARGET}
8140555Smsmith	strip ${.TARGET}
8240555Smsmith
8341821Smsmith${BASE}.help: help.common help.i386
8442807Smsmith	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
8541821Smsmith
8642268Smsmithbeforeinstall:
8742510Smsmith.if exists(${DESTDIR}/boot/loader)
8842510Smsmith	mv ${DESTDIR}/boot/loader ${DESTDIR}/boot/loader.old
8942510Smsmith.endif
9042268Smsmith.if exists(${.OBJDIR}/loader.help)
9142268Smsmith	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
9242268Smsmith		${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
9342268Smsmith.else
9442268Smsmith	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
9542268Smsmith		${.CURDIR}/${BASE}.help ${DESTDIR}/boot
9642268Smsmith.endif
9745759Sdcs.if !exists(${DESTDIR}/boot/loader.rc)
9844622Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
9945759Sdcs		${.CURDIR}/../../forth/loader.rc ${DESTDIR}/boot
10045759Sdcs.endif
10145759Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
10244622Sdcs		${.CURDIR}/../../forth/loader.4th ${DESTDIR}/boot
10344622Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
10444622Sdcs		${.CURDIR}/../../forth/support.4th ${DESTDIR}/boot
10544622Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
10644622Sdcs		${.CURDIR}/../../forth/loader.conf ${DESTDIR}/boot/defaults
10741821Smsmith
10840555Smsmith# Cannot use ${OBJS} above this line
10940555Smsmith.include <bsd.prog.mk>
11040555Smsmith
11140877Smsmith${BASE}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o
11240555Smsmith	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
11340877Smsmith		${LIBFICL} ${LIBSTAND} ${LIBI386} ${LIBSTAND}
11439441Smsmith
11540555Smsmith# If it's not there, don't consider it a target
11640555Smsmith.if exists(${.CURDIR}/../../../i386/include)
11740555Smsmithbeforedepend ${OBJS}: machine
11839441Smsmith
11940338Spetermachine:
12040338Speter	ln -sf ${.CURDIR}/../../../i386/include machine
12140338Speter
12240555Smsmith.endif
12340555Smsmith
12440338SpeterCLEANFILES+=	machine
12540338Speter
12639441Smsmith
127