Makefile revision 40877
1# $Id: Makefile,v 1.15 1998/10/23 22:32:27 msmith Exp $
2
3BASE=		loader
4PROG=		${BASE}
5NOMAN=
6STRIP=
7NEWVERSWHAT=	"bootstrap loader"
8BINDIR?=	/boot
9
10# architecture-specific loader code
11SRCS=		main.c conf.c
12
13# Enable PnP and ISA-PnP code.
14HAVE_PNP=	yes
15HAVE_ISABUS=	yes
16
17# Enable BootForth
18#BOOT_FORTH=	yes
19#CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl
20#LIBFICL=	${.CURDIR}/../../ficl/libficl.a
21
22# Always add MI sources 
23.PATH:		${.CURDIR}/../../common
24.include	<${.CURDIR}/../../common/Makefile.inc>
25CFLAGS+=	-I${.CURDIR}/../../common
26CFLAGS+=	-I${.CURDIR}/../../.. -I.
27
28CLEANFILES+=	vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym
29
30CFLAGS+=	-Wall
31LDFLAGS=	-nostdlib -static -Ttext 0x1000
32
33# i386 standalone support library
34LIBI386=	${.OBJDIR}/../libi386/libi386.a
35CFLAGS+=	-I${.CURDIR}/..
36
37# where to get libstand from
38LIBSTAND=	-lstand
39#LIBSTAND=	${.CURDIR}/../../../lib/libstand/libstand.a
40#CFLAGS+=	-I${.CURDIR}/../../../lib/libstand/
41
42# BTX components
43.if exists(${.OBJDIR}/../btx)
44BTXDIR=		${.OBJDIR}/../btx
45.else
46BTXDIR=		${.CURDIR}/../btx
47.endif
48BTXLDR=		${BTXDIR}/btxldr/btxldr
49BTXKERN=	${BTXDIR}/btx/btx
50BTXCRT=		${BTXDIR}/lib/crt0.o
51CFLAGS+=	-I${.CURDIR}/../btx/lib
52
53# BTX is expecting ELF components
54CFLAGS+=	-elf
55
56# New linker set code
57CFLAGS+=	-DNEW_LINKER_SET
58
59# Debug me!
60CFLAGS+=	-g
61LDFLAGS+=	-g
62
63vers.o:
64	sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
65	${CC} -c vers.c
66
67${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
68	btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
69		${BASE}.bin
70
71${BASE}.bin: ${BASE}.sym
72	cp ${.ALLSRC} ${.TARGET}
73	strip ${.TARGET}
74
75# Cannot use ${OBJS} above this line
76.include <bsd.prog.mk>
77
78${BASE}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o
79	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
80		${LIBFICL} ${LIBSTAND} ${LIBI386} ${LIBSTAND}
81
82# If it's not there, don't consider it a target
83.if exists(${.CURDIR}/../../../i386/include)
84beforedepend ${OBJS}: machine
85
86machine:
87	ln -sf ${.CURDIR}/../../../i386/include machine
88
89.endif
90
91CLEANFILES+=	machine
92
93
94