xref: /freebsd/stand/i386/loader/Makefile (revision 3cbb4cc200f8a0ad7ed08233425ea54524a21f1c)
1# $FreeBSD$
2
3HAVE_ZFS=		${MK_LOADER_ZFS}
4
5LOADER_NET_SUPPORT?=	yes
6LOADER_NFS_SUPPORT?=	yes
7LOADER_TFTP_SUPPORT?=	yes
8LOADER_CD9660_SUPPORT?=	yes
9LOADER_EXT2FS_SUPPORT?=	yes
10LOADER_MSDOS_SUPPORT?=	yes
11LOADER_UFS_SUPPORT?=	yes
12LOADER_GZIP_SUPPORT?=	yes
13LOADER_BZIP2_SUPPORT?=	yes
14
15.include <bsd.init.mk>
16
17LOADER?=	loader_${LOADER_INTERP}
18PROG=		${LOADER}.sym
19INTERNALPROG=
20NEWVERSWHAT?=	"bootstrap loader" x86
21VERSION_FILE=	${.CURDIR}/../loader/version
22
23.PATH:		${BOOTSRC}/i386/loader
24
25# architecture-specific loader code
26SRCS=		main.c conf.c vers.c chain.c
27
28# Include bcache code.
29HAVE_BCACHE=	yes
30
31# Enable PnP and ISA-PnP code.
32HAVE_PNP=	yes
33HAVE_ISABUS=	yes
34
35.if ${MK_LOADER_FIREWIRE} == "yes"
36CFLAGS+=	-DLOADER_FIREWIRE_SUPPORT
37LIBFIREWIRE=	${BOOTOBJ}/i386/libfirewire/libfirewire.a
38.endif
39
40.if ${MK_LOADER_ZFS} == "yes"
41CFLAGS.main.c+=	-I${SYSDIR}/contrib/openzfs/include
42CFLAGS.main.c+=	-I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs
43.endif
44
45.if exists(${.CURDIR}/help.i386)
46HELP_FILES=	${.CURDIR}/help.i386
47.endif
48
49# Always add MI sources
50.include	"${BOOTSRC}/loader.mk"
51
52CLEANFILES+=	${LOADER} ${LOADER}.bin
53
54ORG=		0x0
55
56CFLAGS+=	-Wall
57LDFLAGS+=	-static ${LDFLAGS_ORG} -Wl,--gc-sections
58
59# i386 standalone support library
60LIBI386=	${BOOTOBJ}/i386/libi386/libi386.a
61CFLAGS+=	-I${BOOTSRC}/i386
62
63# Debug me!
64#CFLAGS+=	-g
65#LDFLAGS+=	-g
66
67${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
68	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
69		-b ${BTXKERN} ${LOADER}.bin
70
71${LOADER}.bin: ${LOADER}.sym
72	${STRIPBIN} -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
73
74.if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
75LINKS+=		${BINDIR}/${LOADER} ${BINDIR}/zfsloader
76.endif
77.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
78LINKS+=		${BINDIR}/${LOADER} ${BINDIR}/loader
79.endif
80FILES+=	${LOADER}
81FILESMODE_${LOADER}= ${BINMODE} -b
82
83# XXX crt0.o needs to be first for pxeboot(8) to work
84OBJS=	${BTXCRT}
85
86DPADD=	${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32}
87LDADD=	${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32}
88
89.if ${MACHINE_CPUARCH} == "amd64"
90CFLAGS+=	-DLOADER_PREFER_AMD64
91.endif
92
93.include <bsd.prog.mk>
94