1 # $FreeBSD: src/sys/boot/i386/loader/Makefile,v 1.66 2003/06/26 03:51:57 peter Exp $
6 NEWVERSWHAT= "bootstrap loader" i386
10 # Notes: the 'loader' client is brought in with a virtual base of (typically)
11 # 0xa000 and a code offset of 0x0. The btxldr is loaded at 0x200000 (?).
13 # MEM_BTX_USR_ARG is not used in the boot2->loader stage, only in the
14 # boot1->boot2 stage (XXX what about the use in cdboot and pxeboot?)
18 # architecture-specific loader code
21 # Enable PXE TFTP or NFS support, not both.
22 #CFLAGS+= -DLOADER_TFTP_SUPPORT
23 CFLAGS+= -DLOADER_NFS_SUPPORT
25 # Enable PnP and ISA-PnP code.
30 CFLAGS+= -I${.CURDIR}/../../dloader -I${.CURDIR}/../../dloader/i386
31 .if exists(${.OBJDIR}/../../dloader/libdloader.a)
32 LIBDLOADER= ${.OBJDIR}/../../dloader/libdloader.a
34 LIBDLOADER= ${.CURDIR}/../../dloader/libdloader.a
37 .if defined(LOADER_BZIP2_SUPPORT)
38 CFLAGS+= -DLOADER_BZIP2_SUPPORT
40 .if !defined(LOADER_NO_GZIP_SUPPORT)
41 CFLAGS+= -DLOADER_GZIP_SUPPORT
44 # Always add MI sources
45 .PATH: ${.CURDIR}/../../common
46 .include <${.CURDIR}/../../common/Makefile.inc>
47 CFLAGS+= -I${.CURDIR}/../../common
48 CFLAGS+= -I${.CURDIR}/../../.. -I.
50 CLEANFILES+= vers.c vers.o ${PROG}.list ${PROG}.bin ${PROG}.sym ${PROG}.help
53 COMPILER_LDFLAGS= -nostdlib -static -Ttext ${ORG}
55 # i386 standalone support library
56 LIBI386= ${.OBJDIR}/../libi386/libi386.a
57 CFLAGS+= -I${.CURDIR}/..
59 # where to get libstand from
60 #XXX need a better way to do this
61 LIBSTAND= ${.CURDIR}/../../../../lib/libstand/libstand.a
62 .if !exists(${LIBSTAND})
63 LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a
64 .if !exists(${LIBSTAND})
68 CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
71 .if exists(${.OBJDIR}/../btx)
72 BTXDIR= ${.OBJDIR}/../btx
74 BTXDIR= ${.CURDIR}/../btx
76 BTXLDR= ${BTXDIR}/btxldr/btxldr
77 BTXKERN= ${BTXDIR}/btx/btx
78 BTXCRT= ${BTXDIR}/lib/crt0.o
79 CFLAGS+= -I${.CURDIR}/../btx/lib
81 # BTX is expecting ELF components
87 vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
88 sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
89 ${CC} ${CFLAGS} -c vers.c
91 ${PROG}: ${PROG}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
92 btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
93 -b ${BTXKERN} ${PROG}.bin
94 # /usr/bin/kzip ${.TARGET}
95 # mv ${.TARGET}.kz ${.TARGET}
97 ${PROG}.bin: ${PROG}.sym
98 cp ${.ALLSRC} ${.TARGET}
99 strip -R .comment -R .note ${.TARGET}
101 ${PROG}.help: help.common help.i386
102 cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
104 .PATH: ${.CURDIR}/../../dloader
105 FILES= ${PROG}.help loader.conf loader-bootp.conf dloader.menu
106 FILESDIR_loader.conf= /boot/defaults
107 FILESDIR_loader-bootp.conf= /boot/defaults
108 FILESDIR_dloader.menu= /boot/defaults
110 .if !exists(${DESTDIR}/boot/dloader.rc)
111 FILES+= ${.CURDIR}/dloader.rc
114 .include "../Makefile.inc"
116 # Cannot use ${OBJS} above this line
117 .include <bsd.prog.mk>
119 ${PROG}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBDLOADER} vers.o
120 ${CC} ${COMPILER_LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
121 ${LIBDLOADER} ${LIBI386} ${LIBSTAND}
123 # If it's not there, don't consider it a target
124 .if exists(${.CURDIR}/../../../i386/include)
125 beforedepend ${OBJS}: machine
128 ${LN} -sf ${.CURDIR}/../../../i386/include machine