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