Makefile revision 96342
1# $FreeBSD: head/sys/boot/pc98/loader/Makefile 96342 2002-05-10 09:26:35Z obrien $
2
3BASE=		loader
4PROG=		${BASE}
5STRIP=
6NEWVERSWHAT=	"bootstrap loader" pc98
7BINDIR?=	/boot
8INSTALLFLAGS=	-b
9.if !defined(LOADER_NO_AOUT_SUPPORT)
10LOADER_AOUT_SUPPORT=	yes
11.endif
12
13CFLAGS+=	-ffreestanding
14CFLAGS+=	-DPC98
15
16# architecture-specific loader code
17SRCS=		main.c conf.c
18.PATH:		${.CURDIR}/../../i386/loader
19
20# Enable PXE TFTP or NFS support, not both.
21.if defined(LOADER_TFTP_SUPPORT)
22CFLAGS+=	-DLOADER_TFTP_SUPPORT
23.else
24CFLAGS+=	-DLOADER_NFS_SUPPORT
25.endif
26
27# Enable PnP and ISA-PnP code.
28HAVE_PNP=	yes
29HAVE_ISABUS=	yes
30
31.if !defined(NOFORTH)
32# Enable BootForth
33BOOT_FORTH=	yes
34CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
35.if exists(${.OBJDIR}/../../ficl/libficl.a)
36LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
37.else
38LIBFICL=	${.CURDIR}/../../ficl/libficl.a
39.endif
40.endif
41
42.if defined(LOADER_BZIP2_SUPPORT)
43CFLAGS+=	-DLOADER_BZIP2_SUPPORT
44.endif
45.if !defined(LOADER_NO_GZIP_SUPPORT)
46CFLAGS+=	-DLOADER_GZIP_SUPPORT
47.endif
48
49# Always add MI sources 
50.PATH:		${.CURDIR}/../../common
51.include	<${.CURDIR}/../../common/Makefile.inc>
52CFLAGS+=	-I${.CURDIR}/../../common
53CFLAGS+=	-I${.CURDIR}/../../.. -I. -I${.CURDIR}/../../i386
54
55CLEANFILES+=	vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym ${BASE}.help
56
57CFLAGS+=	-Wall
58LDFLAGS=	-nostdlib -static -Ttext 0x0
59
60# pc98 standalone support library
61LIBPC98=	${.OBJDIR}/../libpc98/libpc98.a
62CFLAGS+=	-I${.CURDIR}/..
63
64# where to get libstand from
65#XXX need a better way to do this
66LIBSTAND=	${.CURDIR}/../../../../lib/libstand/libstand.a
67.if !exists(${LIBSTAND})
68LIBSTAND=	${.OBJDIR}/../../../../lib/libstand/libstand.a
69.if !exists(${LIBSTAND})
70LIBSTAND=	-lstand
71.endif
72.endif
73CFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
74
75# BTX components
76.if exists(${.OBJDIR}/../btx)
77BTXDIR=		${.OBJDIR}/../btx
78.else
79BTXDIR=		${.CURDIR}/../btx
80.endif
81BTXLDR=		${BTXDIR}/btxldr/btxldr
82BTXKERN=	${BTXDIR}/btx/btx
83BTXCRT=		${BTXDIR}/lib/crt0.o
84CFLAGS+=	-I${.CURDIR}/../btx/lib
85
86# BTX is expecting ELF components
87CFLAGS+=	-elf
88
89# Debug me!
90#CFLAGS+=	-g
91#LDFLAGS+=	-g
92
93vers.o:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../i386/loader/version
94	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../i386/loader/version ${NEWVERSWHAT}
95	${CC} -c vers.c
96
97${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
98	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
99		-b ${BTXKERN} ${BASE}.bin
100#	/usr/bin/kzip ${.TARGET}
101#	mv ${.TARGET}.kz ${.TARGET}
102
103${BASE}.bin: ${BASE}.sym
104	cp ${.ALLSRC} ${.TARGET}
105	strip -R .comment -R .note ${.TARGET}
106
107${BASE}.help: help.common help.i386
108	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
109
110.PATH: ${.CURDIR}/../../forth 
111FILES=	${BASE}.help loader.4th support.4th loader.conf
112FILESDIR_loader.conf=	/boot/defaults
113
114.if !exists(${DESTDIR}/boot/loader.rc)
115FILES+=	loader.rc
116.endif
117
118.include <${.CURDIR}/../Makefile.inc>
119
120# Cannot use ${OBJS} above this line
121.include <bsd.prog.mk>
122
123${BASE}.sym: ${OBJS} ${LIBPC98} ${LIBSTAND} ${LIBFICL} vers.o
124	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
125		${LIBFICL} ${LIBPC98} ${LIBSTAND}
126
127# If it's not there, don't consider it a target
128.if exists(${.CURDIR}/../../../i386/include)
129beforedepend ${OBJS}: machine
130
131machine:
132	ln -sf ${.CURDIR}/../../../i386/include machine
133
134.endif
135
136CLEANFILES+=	machine
137