Makefile revision 40243
140243Srnordier# $Id: Makefile,v 1.10 1998/10/07 02:39:32 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.
1439178Smsmith#HAVE_PNP=	yes
1539178Smsmith#HAVE_ISABUS=	yes
1639178Smsmith
1738465Smsmith# Always add MI sources 
1838465Smsmith.PATH:		${.CURDIR}/../../common
1938465Smsmith.include	<${.CURDIR}/../../common/Makefile.inc>
2039646SpeterCFLAGS+=	-I${.CURDIR}/../../common -I.
2138465Smsmith
2239441SmsmithCLEANFILES+=	vers.c vers.o ${BASE}.list setdef0.o setdef1.o setdefs.h \
2339441Smsmith		gensetdefs.o gensetdefs ${BASE}.bin
2438465Smsmith
2538465SmsmithCFLAGS+=	-Wall
2639441SmsmithLDFLAGS=	-nostdlib -static -Ttext 0x1000
2738465Smsmith
2838465Smsmith# i386 standalone support library
2938465SmsmithLIBI386=	${.OBJDIR}/../libi386/libi386.a
3038465SmsmithCFLAGS+=	-I${.CURDIR}/..
3138465Smsmith
3239474Smsmith# where to get libstand from
3339474SmsmithLIBSTAND=	-lstand
3439474Smsmith#LIBSTAND=	${.CURDIR}/../../../lib/libstand/libstand.a
3539664Smsmith#CFLAGS+=	-I${.CURDIR}/../../../lib/libstand/
3639474Smsmith
3739441Smsmith# BTX components
3839646Speter.if exists(${.OBJDIR}/../btx)
3939646SpeterBTXDIR=		${.OBJDIR}/../btx
4039646Speter.else
4139441SmsmithBTXDIR=		${.CURDIR}/../btx
4239646Speter.endif
4339441SmsmithBTXLDR=		${BTXDIR}/btxldr/btxldr
4439441SmsmithBTXKERN=	${BTXDIR}/btx/btx
4539441SmsmithBTXCRT=		${BTXDIR}/lib/crt0.o
4639646SpeterCFLAGS+=	-I${.CURDIR}/../btx/lib
4739441Smsmith
4839441Smsmith# BTX is expecting ELF components
4939441SmsmithCFLAGS+=	-elf
5039441Smsmith
5139664Smsmith# Debug me!
5239664Smsmith#CFLAGS+=	-g
5339664Smsmith#LDFLAGS+=	-g
5439664Smsmith
5538465Smsmithvers.o:
5638465Smsmith	sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
5738465Smsmith	${CC} -c vers.c
5838465Smsmith
5939441Smsmith${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN}
6039450Smsmith	btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
6139450Smsmith		${BASE}.bin
6238465Smsmith
6339441Smsmith${BASE}.bin: ${OBJS} ${LIBI386} vers.o setdef0.o setdef1.o
6440243Srnordier	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} setdef0.o ${OBJS} vers.o setdef1.o \
6539474Smsmith		${LIBSTAND} ${LIBI386} ${LIBSTAND}
6639441Smsmith
6739441Smsmithsetdef0.o:	setdefs.h
6839441Smsmith
6939441Smsmithsetdef1.o:	setdefs.h
7039441Smsmith
7138465Smsmith.include <bsd.prog.mk>
7239441Smsmith
7339441Smsmith# Linker set gymnastics
7439441Smsmithsetdefs.h: gensetdefs ${OBJS}
7539441Smsmith	@echo Generating linker sets
7639441Smsmith	@./gensetdefs ${OBJS} >setdefs.h
7739441Smsmith
7839441Smsmithgensetdefs: gensetdefs.o
7939441Smsmith	${CC} -static gensetdefs.o -o $@
8039441Smsmith
8139441Smsmithgensetdefs.o: gensetdefs.c
8239441Smsmith	${CC} -c $<
8339441Smsmith
8439441Smsmith
85