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