Makefile revision 41107
155714Skris# $Id: Makefile,v 1.18 1998/11/04 03:42:36 msmith Exp $
255714Skris
355714SkrisBASE=		loader
455714SkrisPROG=		${BASE}
555714SkrisNOMAN=
655714SkrisSTRIP=
755714SkrisNEWVERSWHAT=	"bootstrap loader"
8296465SdelphijBINDIR?=	/boot
955714Skris
1055714Skris# architecture-specific loader code
1155714SkrisSRCS=		main.c conf.c
1255714Skris
1355714Skris# Enable PnP and ISA-PnP code.
1455714SkrisHAVE_PNP=	yes
15296465SdelphijHAVE_ISABUS=	yes
1655714Skris
1755714Skris# Enable BootForth
1855714SkrisBOOT_FORTH=	yes
1955714SkrisCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl
2055714Skris.if exists(${.OBJDIR}/../../ficl/libficl.a)
2155714SkrisLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
22296465Sdelphij.else
2355714SkrisLIBFICL=	${.CURDIR}/../../ficl/libficl.a
2455714Skris.endif
2555714Skris
2655714Skris# Always add MI sources 
2755714Skris.PATH:		${.CURDIR}/../../common
2855714Skris.include	<${.CURDIR}/../../common/Makefile.inc>
2955714SkrisCFLAGS+=	-I${.CURDIR}/../../common
3055714SkrisCFLAGS+=	-I${.CURDIR}/../../.. -I.
3155714Skris
3255714SkrisCLEANFILES+=	vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym
3355714Skris
3455714SkrisCFLAGS+=	-Wall
3555714SkrisLDFLAGS=	-nostdlib -static -Ttext 0x1000
3655714Skris
37296465Sdelphij# i386 standalone support library
3855714SkrisLIBI386=	${.OBJDIR}/../libi386/libi386.a
3955714SkrisCFLAGS+=	-I${.CURDIR}/..
40296465Sdelphij
4155714Skris# where to get libstand from
4255714SkrisLIBSTAND=	-lstand
4355714Skris#LIBSTAND=	${.CURDIR}/../../../lib/libstand/libstand.a
4455714Skris#CFLAGS+=	-I${.CURDIR}/../../../lib/libstand/
4555714Skris
4655714Skris# BTX components
4755714Skris.if exists(${.OBJDIR}/../btx)
4855714SkrisBTXDIR=		${.OBJDIR}/../btx
4955714Skris.else
5055714SkrisBTXDIR=		${.CURDIR}/../btx
5155714Skris.endif
52296465SdelphijBTXLDR=		${BTXDIR}/btxldr/btxldr
5355714SkrisBTXKERN=	${BTXDIR}/btx/btx
5455714SkrisBTXCRT=		${BTXDIR}/lib/crt0.o
5555714SkrisCFLAGS+=	-I${.CURDIR}/../btx/lib
5655714Skris
5755714Skris# BTX is expecting ELF components
5855714SkrisCFLAGS+=	-elf
5955714Skris
6055714Skris# New linker set code
6155714SkrisCFLAGS+=	-DNEW_LINKER_SET
6255714Skris
6355714Skris# Debug me!
6455714Skris#CFLAGS+=	-g
65296465Sdelphij#LDFLAGS+=	-g
66160814Ssimon
67296465Sdelphijvers.o:
68296465Sdelphij	sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
69296465Sdelphij	${CC} -c vers.c
70160814Ssimon
71160814Ssimon${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
72296465Sdelphij	btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
73296465Sdelphij		${BASE}.bin
74296465Sdelphij
75160814Ssimon${BASE}.bin: ${BASE}.sym
76160814Ssimon	cp ${.ALLSRC} ${.TARGET}
77296465Sdelphij	strip ${.TARGET}
78296465Sdelphij
79296465Sdelphij# Cannot use ${OBJS} above this line
80160814Ssimon.include <bsd.prog.mk>
81296465Sdelphij
82296465Sdelphij${BASE}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o
8355714Skris	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
84160814Ssimon		${LIBFICL} ${LIBSTAND} ${LIBI386} ${LIBSTAND}
85296465Sdelphij
86# If it's not there, don't consider it a target
87.if exists(${.CURDIR}/../../../i386/include)
88beforedepend ${OBJS}: machine
89
90machine:
91	ln -sf ${.CURDIR}/../../../i386/include machine
92
93.endif
94
95CLEANFILES+=	machine
96
97
98