1 # $FreeBSD: src/sys/boot/i386/loader/Makefile,v 1.66 2003/06/26 03:51:57 peter Exp $
2 # $DragonFly: src/sys/boot/i386/loader/Attic/Makefile,v 1.7 2004/10/14 09:41:01 dillon Exp $
7 NEWVERSWHAT= "bootstrap loader" i386
11 # Notes: the 'loader' client is brought in with a virtual base of (typically)
12 # 0xa000 and a code offset of 0x0. The btxldr is loaded at 0x200000 (?).
14 # MEM_BTX_USR_ARG is not used in the boot2->loader stage, only in the
15 # boot1->boot2 stage (XXX what about the use in cdboot and pxeboot?)
19 # architecture-specific loader code
22 CFLAGS+= -ffreestanding
23 # Enable PXE TFTP or NFS support, not both.
24 .if defined(LOADER_TFTP_SUPPORT)
25 CFLAGS+= -DLOADER_TFTP_SUPPORT
27 CFLAGS+= -DLOADER_NFS_SUPPORT
30 # Enable PnP and ISA-PnP code.
37 CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
38 .if exists(${.OBJDIR}/../../ficl/libficl.a)
39 LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
41 LIBFICL= ${.CURDIR}/../../ficl/libficl.a
45 .if defined(LOADER_BZIP2_SUPPORT)
46 CFLAGS+= -DLOADER_BZIP2_SUPPORT
48 .if !defined(LOADER_NO_GZIP_SUPPORT)
49 CFLAGS+= -DLOADER_GZIP_SUPPORT
52 # Always add MI sources
53 .PATH: ${.CURDIR}/../../common
54 .include <${.CURDIR}/../../common/Makefile.inc>
55 CFLAGS+= -I${.CURDIR}/../../common
56 CFLAGS+= -I${.CURDIR}/../../.. -I.
58 CLEANFILES+= vers.c vers.o ${PROG}.list ${PROG}.bin ${PROG}.sym ${PROG}.help
61 LDFLAGS= -nostdlib -static -Ttext ${ORG}
63 # i386 standalone support library
64 LIBI386= ${.OBJDIR}/../libi386/libi386.a
65 CFLAGS+= -I${.CURDIR}/..
67 # where to get libstand from
68 #XXX need a better way to do this
69 LIBSTAND= ${.CURDIR}/../../../../lib/libstand/libstand.a
70 .if !exists(${LIBSTAND})
71 LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a
72 .if !exists(${LIBSTAND})
76 CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
79 .if exists(${.OBJDIR}/../btx)
80 BTXDIR= ${.OBJDIR}/../btx
82 BTXDIR= ${.CURDIR}/../btx
84 BTXLDR= ${BTXDIR}/btxldr/btxldr
85 BTXKERN= ${BTXDIR}/btx/btx
86 BTXCRT= ${BTXDIR}/lib/crt0.o
87 CFLAGS+= -I${.CURDIR}/../btx/lib
89 # BTX is expecting ELF components
96 vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
97 sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
98 ${CC} ${CFLAGS} -c vers.c
100 ${PROG}: ${PROG}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
101 btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
102 -b ${BTXKERN} ${PROG}.bin
103 # /usr/bin/kzip ${.TARGET}
104 # mv ${.TARGET}.kz ${.TARGET}
106 ${PROG}.bin: ${PROG}.sym
107 cp ${.ALLSRC} ${.TARGET}
108 strip -R .comment -R .note ${.TARGET}
110 ${PROG}.help: help.common help.i386
111 cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
113 .PATH: ${.CURDIR}/../../forth
114 FILES= ${PROG}.help loader.4th support.4th loader.conf loader-bootp.conf
115 FILES+= screen.4th frames.4th beastie.4th
116 FILESDIR_loader.conf= /boot/defaults
117 FILESDIR_loader-bootp.conf= /boot/defaults
119 .if !exists(${DESTDIR}/boot/loader.rc)
120 FILES+= ${.CURDIR}/loader.rc
123 .include "../Makefile.inc"
125 # Cannot use ${OBJS} above this line
126 .include <bsd.prog.mk>
128 ${PROG}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o
129 ${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
130 ${LIBFICL} ${LIBI386} ${LIBSTAND}
132 # If it's not there, don't consider it a target
133 .if exists(${.CURDIR}/../../../i386/include)
134 beforedepend ${OBJS}: machine
137 ln -sf ${.CURDIR}/../../../i386/include machine