Makefile revision 56992
150477Speter# $FreeBSD: head/sys/boot/i386/loader/Makefile 56992 2000-02-04 20:57:09Z luigi $
238465Smsmith
339441SmsmithBASE=		loader
456693SjhbPROG=		${BASE} cdboot
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
1956992Sluigi.if !defined(NOFORTH)
2040877Smsmith# Enable BootForth
2156903SjhbBOOT_FORTH=	yes
2256903SjhbCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
2341107Sjkh.if exists(${.OBJDIR}/../../ficl/libficl.a)
2441107SjkhLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
2541107Sjkh.else
2641107SjkhLIBFICL=	${.CURDIR}/../../ficl/libficl.a
2741107Sjkh.endif
2856992Sluigi.endif
2940877Smsmith
3038465Smsmith# Always add MI sources 
3138465Smsmith.PATH:		${.CURDIR}/../../common
3238465Smsmith.include	<${.CURDIR}/../../common/Makefile.inc>
3340338SpeterCFLAGS+=	-I${.CURDIR}/../../common
3440338SpeterCFLAGS+=	-I${.CURDIR}/../../.. -I.
3538465Smsmith
3641821SmsmithCLEANFILES+=	vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym ${BASE}.help
3738465Smsmith
3838465SmsmithCFLAGS+=	-Wall
3944243SmsmithLDFLAGS=	-nostdlib -static -Ttext 0x0
4038465Smsmith
4138465Smsmith# i386 standalone support library
4238465SmsmithLIBI386=	${.OBJDIR}/../libi386/libi386.a
4338465SmsmithCFLAGS+=	-I${.CURDIR}/..
4438465Smsmith
4539474Smsmith# where to get libstand from
4639474SmsmithLIBSTAND=	-lstand
4739474Smsmith#LIBSTAND=	${.CURDIR}/../../../lib/libstand/libstand.a
4839664Smsmith#CFLAGS+=	-I${.CURDIR}/../../../lib/libstand/
4939474Smsmith
5056752Sjhb# where to get cdldr from
5156752Sjhb.if exists(${.OBJDIR}/../cdldr)
5256752SjhbCDLDR=		${.OBJDIR}/../cdldr/cdldr
5356752Sjhb.else
5456752SjhbCDLDR=		${.CURDIR}/../cdldr/cdldr
5556752Sjhb.endif
5656752Sjhb
5739441Smsmith# BTX components
5839646Speter.if exists(${.OBJDIR}/../btx)
5939646SpeterBTXDIR=		${.OBJDIR}/../btx
6039646Speter.else
6139441SmsmithBTXDIR=		${.CURDIR}/../btx
6239646Speter.endif
6339441SmsmithBTXLDR=		${BTXDIR}/btxldr/btxldr
6439441SmsmithBTXKERN=	${BTXDIR}/btx/btx
6539441SmsmithBTXCRT=		${BTXDIR}/lib/crt0.o
6639646SpeterCFLAGS+=	-I${.CURDIR}/../btx/lib
6739441Smsmith
6839441Smsmith# BTX is expecting ELF components
6939441SmsmithCFLAGS+=	-elf
7039441Smsmith
7140555Smsmith# New linker set code
7240555SmsmithCFLAGS+=	-DNEW_LINKER_SET
7340555Smsmith
7439664Smsmith# Debug me!
7540884Smsmith#CFLAGS+=	-g
7640884Smsmith#LDFLAGS+=	-g
7739664Smsmith
7848351Spetervers.o:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
7948351Speter	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
8038465Smsmith	${CC} -c vers.c
8138465Smsmith
8256693Sjhbcdboot: ${BASE} ${CDLDR}
8356693Sjhb	cat ${CDLDR} ${BASE} > ${.TARGET}.tmp
8456693Sjhb	dd if=${.TARGET}.tmp of=${.TARGET} obs=2k conv=osync
8556693Sjhb	rm ${.TARGET}.tmp
8656693Sjhb
8742274Smsmith${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT} ${BASE}.help
8839450Smsmith	btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
8939450Smsmith		${BASE}.bin
9042493Smsmith#	/usr/bin/kzip ${.TARGET}
9142493Smsmith#	mv ${.TARGET}.kz ${.TARGET}
9238465Smsmith
9340555Smsmith${BASE}.bin: ${BASE}.sym
9440555Smsmith	cp ${.ALLSRC} ${.TARGET}
9540555Smsmith	strip ${.TARGET}
9640555Smsmith
9741821Smsmith${BASE}.help: help.common help.i386
9842807Smsmith	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
9941821Smsmith
10042268Smsmithbeforeinstall:
10142510Smsmith.if exists(${DESTDIR}/boot/loader)
10242510Smsmith	mv ${DESTDIR}/boot/loader ${DESTDIR}/boot/loader.old
10342510Smsmith.endif
10442268Smsmith.if exists(${.OBJDIR}/loader.help)
10542268Smsmith	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
10642268Smsmith		${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
10742268Smsmith.else
10842268Smsmith	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
10942268Smsmith		${.CURDIR}/${BASE}.help ${DESTDIR}/boot
11042268Smsmith.endif
11145759Sdcs.if !exists(${DESTDIR}/boot/loader.rc)
11244622Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
11345759Sdcs		${.CURDIR}/../../forth/loader.rc ${DESTDIR}/boot
11445759Sdcs.endif
11545759Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
11644622Sdcs		${.CURDIR}/../../forth/loader.4th ${DESTDIR}/boot
11744622Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
11844622Sdcs		${.CURDIR}/../../forth/support.4th ${DESTDIR}/boot
11944622Sdcs	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
12044622Sdcs		${.CURDIR}/../../forth/loader.conf ${DESTDIR}/boot/defaults
12141821Smsmith
12240555Smsmith# Cannot use ${OBJS} above this line
12340555Smsmith.include <bsd.prog.mk>
12440555Smsmith
12540877Smsmith${BASE}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o
12640555Smsmith	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
12740877Smsmith		${LIBFICL} ${LIBSTAND} ${LIBI386} ${LIBSTAND}
12839441Smsmith
12940555Smsmith# If it's not there, don't consider it a target
13040555Smsmith.if exists(${.CURDIR}/../../../i386/include)
13140555Smsmithbeforedepend ${OBJS}: machine
13239441Smsmith
13340338Spetermachine:
13440338Speter	ln -sf ${.CURDIR}/../../../i386/include machine
13540338Speter
13640555Smsmith.endif
13740555Smsmith
13840338SpeterCLEANFILES+=	machine
13940338Speter
14039441Smsmith
141