Makefile revision 39857
139857Sjkh# $Id: Makefile,v 1.8 1998/09/30 22:37:47 peter 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
1739441Smsmith# Verbose ls causes extra heap usage
1839441SmsmithCFLAGS+=	-DVERBOSE_LS
1938465Smsmith
2038465Smsmith# Always add MI sources 
2138465Smsmith.PATH:		${.CURDIR}/../../common
2238465Smsmith.include	<${.CURDIR}/../../common/Makefile.inc>
2339646SpeterCFLAGS+=	-I${.CURDIR}/../../common -I.
2438465Smsmith
2539441SmsmithCLEANFILES+=	vers.c vers.o ${BASE}.list setdef0.o setdef1.o setdefs.h \
2639441Smsmith		gensetdefs.o gensetdefs ${BASE}.bin
2738465Smsmith
2838465SmsmithCFLAGS+=	-Wall
2939441SmsmithLDFLAGS=	-nostdlib -static -Ttext 0x1000
3038465Smsmith
3138465Smsmith# i386 standalone support library
3238465SmsmithLIBI386=	${.OBJDIR}/../libi386/libi386.a
3338465SmsmithCFLAGS+=	-I${.CURDIR}/..
3438465Smsmith
3539474Smsmith# where to get libstand from
3639474SmsmithLIBSTAND=	-lstand
3739474Smsmith#LIBSTAND=	${.CURDIR}/../../../lib/libstand/libstand.a
3839664Smsmith#CFLAGS+=	-I${.CURDIR}/../../../lib/libstand/
3939474Smsmith
4039441Smsmith# BTX components
4139646Speter.if exists(${.OBJDIR}/../btx)
4239646SpeterBTXDIR=		${.OBJDIR}/../btx
4339646Speter.else
4439441SmsmithBTXDIR=		${.CURDIR}/../btx
4539646Speter.endif
4639441SmsmithBTXLDR=		${BTXDIR}/btxldr/btxldr
4739441SmsmithBTXKERN=	${BTXDIR}/btx/btx
4839441SmsmithBTXCRT=		${BTXDIR}/lib/crt0.o
4939646SpeterCFLAGS+=	-I${.CURDIR}/../btx/lib
5039441Smsmith
5139441Smsmith# BTX is expecting ELF components
5239441SmsmithCFLAGS+=	-elf
5339441Smsmith
5439664Smsmith# Debug me!
5539664Smsmith#CFLAGS+=	-g
5639664Smsmith#LDFLAGS+=	-g
5739664Smsmith
5838465Smsmithvers.o:
5938465Smsmith	sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
6038465Smsmith	${CC} -c vers.c
6138465Smsmith
6239441Smsmith${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN}
6339450Smsmith	btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
6439450Smsmith		${BASE}.bin
6538465Smsmith
6639441Smsmith${BASE}.bin: ${OBJS} ${LIBI386} vers.o setdef0.o setdef1.o
6739474Smsmith	${LD} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} setdef0.o ${OBJS} vers.o setdef1.o \
6839474Smsmith		${LIBSTAND} ${LIBI386} ${LIBSTAND}
6939441Smsmith
7039441Smsmithsetdef0.o:	setdefs.h
7139441Smsmith
7239441Smsmithsetdef1.o:	setdefs.h
7339441Smsmith
7438465Smsmith.include <bsd.prog.mk>
7539441Smsmith
7639441Smsmith# Linker set gymnastics
7739441Smsmithsetdefs.h: gensetdefs ${OBJS}
7839441Smsmith	@echo Generating linker sets
7939441Smsmith	@./gensetdefs ${OBJS} >setdefs.h
8039441Smsmith
8139441Smsmithgensetdefs: gensetdefs.o
8239441Smsmith	${CC} -static gensetdefs.o -o $@
8339441Smsmith
8439441Smsmithgensetdefs.o: gensetdefs.c
8539441Smsmith	${CC} -c $<
8639441Smsmith
8739441Smsmith
88