1 # $FreeBSD: src/sys/boot/i386/loader/Makefile,v 1.66 2003/06/26 03:51:57 peter Exp $
2 # $DragonFly: src/sys/boot/pc32/loader/Makefile,v 1.11 2005/09/03 23:52:49 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 #CFLAGS+= -DLOADER_TFTP_SUPPORT
25 CFLAGS+= -DLOADER_NFS_SUPPORT
27 # Enable PnP and ISA-PnP code.
34 CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
35 .if exists(${.OBJDIR}/../../ficl/libficl.a)
36 LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
38 LIBFICL= ${.CURDIR}/../../ficl/libficl.a
42 .if defined(LOADER_BZIP2_SUPPORT)
43 CFLAGS+= -DLOADER_BZIP2_SUPPORT
45 .if !defined(LOADER_NO_GZIP_SUPPORT)
46 CFLAGS+= -DLOADER_GZIP_SUPPORT
49 # Always add MI sources
50 .PATH: ${.CURDIR}/../../common
51 .include <${.CURDIR}/../../common/Makefile.inc>
52 CFLAGS+= -I${.CURDIR}/../../common
53 CFLAGS+= -I${.CURDIR}/../../.. -I.
55 CLEANFILES+= vers.c vers.o ${PROG}.list ${PROG}.bin ${PROG}.sym ${PROG}.help
58 LDFLAGS= -nostdlib -static -Ttext ${ORG}
60 # i386 standalone support library
61 LIBI386= ${.OBJDIR}/../libi386/libi386.a
62 CFLAGS+= -I${.CURDIR}/..
64 # where to get libstand from
65 #XXX need a better way to do this
66 LIBSTAND= ${.CURDIR}/../../../../lib/libstand/libstand.a
67 .if !exists(${LIBSTAND})
68 LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a
69 .if !exists(${LIBSTAND})
73 CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
76 .if exists(${.OBJDIR}/../btx)
77 BTXDIR= ${.OBJDIR}/../btx
79 BTXDIR= ${.CURDIR}/../btx
81 BTXLDR= ${BTXDIR}/btxldr/btxldr
82 BTXKERN= ${BTXDIR}/btx/btx
83 BTXCRT= ${BTXDIR}/lib/crt0.o
84 CFLAGS+= -I${.CURDIR}/../btx/lib
86 # BTX is expecting ELF components
93 vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
94 sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
95 ${CC} ${CFLAGS} -c vers.c
97 ${PROG}: ${PROG}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
98 btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
99 -b ${BTXKERN} ${PROG}.bin
100 # /usr/bin/kzip ${.TARGET}
101 # mv ${.TARGET}.kz ${.TARGET}
103 ${PROG}.bin: ${PROG}.sym
104 cp ${.ALLSRC} ${.TARGET}
105 strip -R .comment -R .note ${.TARGET}
107 ${PROG}.help: help.common help.i386
108 cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
110 .PATH: ${.CURDIR}/../../forth
111 FILES= ${PROG}.help loader.4th support.4th loader.conf loader-bootp.conf
112 FILES+= screen.4th frames.4th beastie.4th
113 FILESDIR_loader.conf= /boot/defaults
114 FILESDIR_loader-bootp.conf= /boot/defaults
116 .if !exists(${DESTDIR}/boot/loader.rc)
117 FILES+= ${.CURDIR}/loader.rc
120 .include "../Makefile.inc"
122 # Cannot use ${OBJS} above this line
123 .include <bsd.prog.mk>
125 ${PROG}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o
126 ${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
127 ${LIBFICL} ${LIBI386} ${LIBSTAND}
129 # If it's not there, don't consider it a target
130 .if exists(${.CURDIR}/../../../i386/include)
131 beforedepend ${OBJS}: machine
134 ${LN} -sf ${.CURDIR}/../../../i386/include machine