Makefile revision 40338
140338Speter# $Id: Makefile,v 1.11 1998/10/12 01:03:00 rnordier 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.
1439178Smsmith#HAVE_PNP=	yes
1539178Smsmith#HAVE_ISABUS=	yes
1639178Smsmith
1738465Smsmith# Always add MI sources 
1838465Smsmith.PATH:		${.CURDIR}/../../common
1938465Smsmith.include	<${.CURDIR}/../../common/Makefile.inc>
2040338SpeterCFLAGS+=	-I${.CURDIR}/../../common
2140338SpeterCFLAGS+=	-I${.CURDIR}/../../.. -I.
2238465Smsmith
2339441SmsmithCLEANFILES+=	vers.c vers.o ${BASE}.list setdef0.o setdef1.o setdefs.h \
2439441Smsmith		gensetdefs.o gensetdefs ${BASE}.bin
2538465Smsmith
2638465SmsmithCFLAGS+=	-Wall
2739441SmsmithLDFLAGS=	-nostdlib -static -Ttext 0x1000
2838465Smsmith
2938465Smsmith# i386 standalone support library
3038465SmsmithLIBI386=	${.OBJDIR}/../libi386/libi386.a
3138465SmsmithCFLAGS+=	-I${.CURDIR}/..
3238465Smsmith
3339474Smsmith# where to get libstand from
3439474SmsmithLIBSTAND=	-lstand
3539474Smsmith#LIBSTAND=	${.CURDIR}/../../../lib/libstand/libstand.a
3639664Smsmith#CFLAGS+=	-I${.CURDIR}/../../../lib/libstand/
3739474Smsmith
3839441Smsmith# BTX components
3939646Speter.if exists(${.OBJDIR}/../btx)
4039646SpeterBTXDIR=		${.OBJDIR}/../btx
4139646Speter.else
4239441SmsmithBTXDIR=		${.CURDIR}/../btx
4339646Speter.endif
4439441SmsmithBTXLDR=		${BTXDIR}/btxldr/btxldr
4539441SmsmithBTXKERN=	${BTXDIR}/btx/btx
4639441SmsmithBTXCRT=		${BTXDIR}/lib/crt0.o
4739646SpeterCFLAGS+=	-I${.CURDIR}/../btx/lib
4839441Smsmith
4939441Smsmith# BTX is expecting ELF components
5039441SmsmithCFLAGS+=	-elf
5139441Smsmith
5239664Smsmith# Debug me!
5339664Smsmith#CFLAGS+=	-g
5439664Smsmith#LDFLAGS+=	-g
5539664Smsmith
5638465Smsmithvers.o:
5738465Smsmith	sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
5838465Smsmith	${CC} -c vers.c
5938465Smsmith
6039441Smsmith${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN}
6139450Smsmith	btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
6239450Smsmith		${BASE}.bin
6338465Smsmith
6439441Smsmith${BASE}.bin: ${OBJS} ${LIBI386} vers.o setdef0.o setdef1.o
6540243Srnordier	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} setdef0.o ${OBJS} vers.o setdef1.o \
6639474Smsmith		${LIBSTAND} ${LIBI386} ${LIBSTAND}
6739441Smsmith
6839441Smsmithsetdef0.o:	setdefs.h
6939441Smsmith
7039441Smsmithsetdef1.o:	setdefs.h
7139441Smsmith
7240338Spetermachine:
7340338Speter	ln -sf ${.CURDIR}/../../../i386/include machine
7440338Speter
7540338SpeterCLEANFILES+=	machine
7640338Speter
7738465Smsmith.include <bsd.prog.mk>
7839441Smsmith
7939441Smsmith# Linker set gymnastics
8039441Smsmithsetdefs.h: gensetdefs ${OBJS}
8139441Smsmith	@echo Generating linker sets
8239441Smsmith	@./gensetdefs ${OBJS} >setdefs.h
8339441Smsmith
8439441Smsmithgensetdefs: gensetdefs.o
8539441Smsmith	${CC} -static gensetdefs.o -o $@
8639441Smsmith
8739441Smsmithgensetdefs.o: gensetdefs.c
8839441Smsmith	${CC} -c $<
8939441Smsmith
9040338Speterbeforedepend ${OBJS}: machine
91