Makefile revision 125537
1# $FreeBSD: head/sys/boot/i386/loader/Makefile 125537 2004-02-06 21:58:32Z ru $
2
3NEWVERSWHAT=	"bootstrap loader" i386
4
5# architecture-specific loader code
6SRCS=		main.c conf.c vers.c
7
8CFLAGS+=	-ffreestanding
9# Enable PXE TFTP or NFS support, not both.
10.if defined(LOADER_TFTP_SUPPORT)
11CFLAGS+=	-DLOADER_TFTP_SUPPORT
12.else
13CFLAGS+=	-DLOADER_NFS_SUPPORT
14.endif
15
16# Enable PnP and ISA-PnP code.
17HAVE_PNP=	yes
18HAVE_ISABUS=	yes
19
20.if !defined(NOFORTH)
21# Enable BootForth
22BOOT_FORTH=	yes
23CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
24.if exists(${.OBJDIR}/../../ficl/libficl.a)
25LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
26.else
27LIBFICL=	${.CURDIR}/../../ficl/libficl.a
28.endif
29.endif
30
31.if defined(LOADER_BZIP2_SUPPORT)
32CFLAGS+=	-DLOADER_BZIP2_SUPPORT
33.endif
34.if !defined(LOADER_NO_GZIP_SUPPORT)
35CFLAGS+=	-DLOADER_GZIP_SUPPORT
36.endif
37
38# Always add MI sources 
39.PATH:		${.CURDIR}/../../common
40.include	"${.CURDIR}/../../common/Makefile.inc"
41CFLAGS+=	-I${.CURDIR}/../../common
42CFLAGS+=	-I.
43
44CLEANFILES=	vers.c loader loader.list loader.bin loader.sym loader.help
45
46CFLAGS+=	-Wall
47LDFLAGS=	-nostdlib -static -Ttext 0x0
48
49# i386 standalone support library
50LIBI386=	${.OBJDIR}/../libi386/libi386.a
51CFLAGS+=	-I${.CURDIR}/..
52
53# BTX components
54CFLAGS+=	-I${.CURDIR}/../btx/lib
55
56# BTX is expecting ELF components
57CFLAGS+=	-elf
58
59# Debug me!
60#CFLAGS+=	-g
61#LDFLAGS+=	-g
62
63# Pick up ../Makefile.inc early.
64.include <bsd.init.mk>
65
66vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
67	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
68
69loader: loader.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
70	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
71		-b ${BTXKERN} loader.bin
72#	/usr/bin/kzip ${.TARGET}
73#	mv ${.TARGET}.kz ${.TARGET}
74
75loader.bin: loader.sym
76	cp ${.ALLSRC} ${.TARGET}
77	strip -R .comment -R .note ${.TARGET}
78
79loader.help: help.common help.i386
80	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
81
82.PATH: ${.CURDIR}/../../forth 
83FILES=	loader loader.help loader.4th support.4th loader.conf
84FILES+= screen.4th frames.4th beastie.4th
85# XXX INSTALLFLAGS_loader= -b
86FILESMODE_loader= ${BINMODE} -b
87FILESDIR_loader.conf=	/boot/defaults
88
89.if !exists(${DESTDIR}/boot/loader.rc)
90FILES+=	${.CURDIR}/loader.rc
91.endif
92
93OBJS=	${SRCS:N*.h:R:S/$/.o/g}
94
95loader.sym: ${OBJS} ${LIBFICL} ${LIBI386} ${LIBSTAND}
96	${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} \
97		${LIBFICL} ${LIBI386} ${LIBSTAND}
98
99.if defined(REALLY_AMD64)
100${OBJS}: machine
101CLEANFILES+=	machine
102machine:
103	ln -sf ${.CURDIR}/../../../i386/include machine
104.endif
105
106.include <bsd.prog.mk>
107