Makefile revision 41107
1119610Sache# $Id: Makefile,v 1.18 1998/11/04 03:42:36 msmith Exp $
2119610Sache
3119610SacheBASE=		loader
4119610SachePROG=		${BASE}
5119610SacheNOMAN=
6119610SacheSTRIP=
7119610SacheNEWVERSWHAT=	"bootstrap loader"
8119610SacheBINDIR?=	/boot
9119610Sache
10119610Sache# architecture-specific loader code
11119610SacheSRCS=		main.c conf.c
12119610Sache
13119610Sache# Enable PnP and ISA-PnP code.
14119610SacheHAVE_PNP=	yes
15119610SacheHAVE_ISABUS=	yes
16119610Sache
17119610Sache# Enable BootForth
18119610SacheBOOT_FORTH=	yes
19119610SacheCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl
20119610Sache.if exists(${.OBJDIR}/../../ficl/libficl.a)
21119610SacheLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
22119610Sache.else
23119610SacheLIBFICL=	${.CURDIR}/../../ficl/libficl.a
24119610Sache.endif
25119610Sache
26119610Sache# Always add MI sources 
27119610Sache.PATH:		${.CURDIR}/../../common
28119610Sache.include	<${.CURDIR}/../../common/Makefile.inc>
29119610SacheCFLAGS+=	-I${.CURDIR}/../../common
30119610SacheCFLAGS+=	-I${.CURDIR}/../../.. -I.
31119610Sache
32119610SacheCLEANFILES+=	vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym
33119610Sache
34119610SacheCFLAGS+=	-Wall
35165670SacheLDFLAGS=	-nostdlib -static -Ttext 0x1000
36119610Sache
37119610Sache# i386 standalone support library
38165670SacheLIBI386=	${.OBJDIR}/../libi386/libi386.a
39165670SacheCFLAGS+=	-I${.CURDIR}/..
40165670Sache
41165670Sache# where to get libstand from
42165670SacheLIBSTAND=	-lstand
43165670Sache#LIBSTAND=	${.CURDIR}/../../../lib/libstand/libstand.a
44165670Sache#CFLAGS+=	-I${.CURDIR}/../../../lib/libstand/
45165670Sache
46165670Sache# BTX components
47165670Sache.if exists(${.OBJDIR}/../btx)
48136644SacheBTXDIR=		${.OBJDIR}/../btx
49119610Sache.else
50119610SacheBTXDIR=		${.CURDIR}/../btx
51119610Sache.endif
52119610SacheBTXLDR=		${BTXDIR}/btxldr/btxldr
53136644SacheBTXKERN=	${BTXDIR}/btx/btx
54136644SacheBTXCRT=		${BTXDIR}/lib/crt0.o
55136644SacheCFLAGS+=	-I${.CURDIR}/../btx/lib
56136644Sache
57136644Sache# BTX is expecting ELF components
58136644SacheCFLAGS+=	-elf
59119610Sache
60119610Sache# New linker set code
61119610SacheCFLAGS+=	-DNEW_LINKER_SET
62119610Sache
63119610Sache# Debug me!
64119610Sache#CFLAGS+=	-g
65119610Sache#LDFLAGS+=	-g
66119610Sache
67119610Sachevers.o:
68119610Sache	sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
69119610Sache	${CC} -c vers.c
70119610Sache
71119610Sache${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
72119610Sache	btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
73119610Sache		${BASE}.bin
74119610Sache
75119610Sache${BASE}.bin: ${BASE}.sym
76119610Sache	cp ${.ALLSRC} ${.TARGET}
77119610Sache	strip ${.TARGET}
78119610Sache
79119610Sache# Cannot use ${OBJS} above this line
80119610Sache.include <bsd.prog.mk>
81119610Sache
82119610Sache${BASE}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o
83119610Sache	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
84119610Sache		${LIBFICL} ${LIBSTAND} ${LIBI386} ${LIBSTAND}
85119610Sache
86119610Sache# If it's not there, don't consider it a target
87119610Sache.if exists(${.CURDIR}/../../../i386/include)
88119610Sachebeforedepend ${OBJS}: machine
89119610Sache
90119610Sachemachine:
91119610Sache	ln -sf ${.CURDIR}/../../../i386/include machine
92119610Sache
93119610Sache.endif
94119610Sache
95119610SacheCLEANFILES+=	machine
96119610Sache
97119610Sache
98119610Sache