xref: /freebsd/stand/i386/loader/Makefile (revision cddbc3b40812213ff00041f79174cac0be360a2a)
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 exists(${.CURDIR}/help.i386)
41HELP_FILES=	${.CURDIR}/help.i386
42.endif
43
44# Always add MI sources
45.include	"${BOOTSRC}/loader.mk"
46
47CLEANFILES+=	${LOADER} ${LOADER}.bin
48
49CFLAGS+=	-Wall
50LDFLAGS+=	-static -Ttext 0x0
51
52# i386 standalone support library
53LIBI386=	${BOOTOBJ}/i386/libi386/libi386.a
54CFLAGS+=	-I${BOOTSRC}/i386
55
56# Debug me!
57#CFLAGS+=	-g
58#LDFLAGS+=	-g
59
60${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
61	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
62		-b ${BTXKERN} ${LOADER}.bin
63
64${LOADER}.bin: ${LOADER}.sym
65	strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
66
67.if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
68LINKS+=		${BINDIR}/${LOADER} ${BINDIR}/zfsloader
69.endif
70.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
71LINKS+=		${BINDIR}/${LOADER} ${BINDIR}/loader
72.endif
73FILES+=	${LOADER}
74FILESMODE_${LOADER}= ${BINMODE} -b
75
76# XXX crt0.o needs to be first for pxeboot(8) to work
77OBJS=	${BTXCRT}
78
79DPADD=	${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32}
80LDADD=	${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32}
81
82.if ${MACHINE_CPUARCH} == "amd64"
83CFLAGS+=	-DLOADER_PREFER_AMD64
84.endif
85
86.include <bsd.prog.mk>
87