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