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