xref: /dragonfly/stand/boot/pc32/loader_tftp/Makefile (revision 7d3e9a5b)
1# Works like the normal loader except the kernel, modules, and other loader
2# files are loaded via TFTP instead of NFS.
3
4PROG=		loader_tftp
5STRIP=
6NEWVERSWHAT=	"bootstrap loader" i386
7BINDIR?=	/boot
8INSTALLFLAGS=	-b
9
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 (?).
12#
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?)
15#
16
17.PATH:		${.CURDIR}/../loader
18# architecture-specific loader code
19SRCS=		main.c conf.c
20
21CFLAGS+=	-DLOADER_TFTP_SUPPORT
22#CFLAGS+=	-DLOADER_NFS_SUPPORT
23
24# Enable PnP and ISA-PnP code.
25HAVE_PNP=	yes
26HAVE_ISABUS=	yes
27
28BOOT_DLOADER=	yes
29CFLAGS+=	-I${.CURDIR}/../../dloader
30.if exists(${.OBJDIR}/../../dloader32/libdloader32.a)
31LIBDLOADER=	${.OBJDIR}/../../dloader32/libdloader32.a
32.else
33LIBDLOADER=	${.CURDIR}/../../dloader32/libdloader32.a
34.endif
35
36.if defined(LOADER_BZIP2_SUPPORT)
37CFLAGS+=	-DLOADER_BZIP2_SUPPORT
38.endif
39.if defined(LOADER_SPLITFS_SUPPORT)
40CFLAGS+=	-DLOADER_SPLITFS_SUPPORT
41.endif
42.if !defined(LOADER_NO_GZIP_SUPPORT)
43CFLAGS+=	-DLOADER_GZIP_SUPPORT
44.endif
45
46# Always add MI sources
47.PATH:		${.CURDIR}/../../common
48.include	<${.CURDIR}/../../common/Makefile.inc>
49CFLAGS+=	-I${.CURDIR}/../../common
50CFLAGS+=	-I${.CURDIR}/../../.. -I.
51
52CLEANFILES+=	vers.c vers.o ${PROG}.list ${PROG}.bin ${PROG}.sym ${PROG}.help
53
54CFLAGS+=		-Wall
55COMPILER_LDFLAGS=	-nostdlib -static
56COMPILER_LDFLAGS+=	-Wl,--script,${.CURDIR}/../loader/loader.ldscript
57
58# i386 standalone support library
59LIBI386=	${.OBJDIR}/../libi386/libi386.a
60CFLAGS+=	-I${.CURDIR}/..
61
62# where to get libstand from
63#XXX need a better way to do this
64LIBSTAND=	${.CURDIR}/../../libstand32/libstand32.a
65.if !exists(${LIBSTAND})
66LIBSTAND=	${.OBJDIR}/../../libstand32/libstand32.a
67.endif
68CFLAGS+=	-I${.CURDIR}/../../../lib
69
70# BTX components
71.if exists(${.OBJDIR}/../btx)
72BTXDIR=		${.OBJDIR}/../btx
73.else
74BTXDIR=		${.CURDIR}/../btx
75.endif
76BTXLDR=		${BTXDIR}/btxldr/btxldr
77BTXKERN=	${BTXDIR}/btx/btx
78BTXCRT=		${BTXDIR}/lib/crt0.o
79CFLAGS+=	-I${.CURDIR}/../btx/lib
80
81# Debug me!
82#CFLAGS+=	-g
83
84vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
85	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
86
87vers.o: vers.c
88	${CC} ${CFLAGS} -c vers.c
89
90${PROG}: ${PROG}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
91	${.OBJDIR}/../btxld/btxld.nx -v -f aout -e ${LOADER_ADDRESS} \
92	    -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} ${PROG}.bin
93
94${PROG}.bin: ${PROG}.sym
95	cp ${.ALLSRC} ${.TARGET}
96	strip -R .comment -R .note -R .note.gnu.gold-version ${.TARGET}
97
98${PROG}.help: help.common help.i386
99	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
100
101.PATH: ${.CURDIR}/../../dloader
102FILES=	${PROG}.help loader.conf loader-bootp.conf
103FILESDIR_loader.conf=	/boot/defaults
104FILESDIR_loader-bootp.conf=	/boot/defaults
105
106.if !exists(${DESTDIR}/boot/dloader.rc)
107FILES+=	${.CURDIR}/../loader/dloader.rc
108.endif
109
110.include "../Makefile.inc"
111
112# Cannot use ${OBJS} above this line
113.include <bsd.prog.mk>
114
115${PROG}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBDLOADER} vers.o
116	${CC} ${COMPILER_LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
117		${LIBDLOADER} ${LIBI386} ${LIBSTAND}
118