xref: /freebsd/stand/i386/loader/Makefile (revision a21def4d568fd2f6723252c16e116b5e7d8125eb)
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 gfx_fb.c 8x16.c
27
28CFLAGS.gfx_fb.c += -I${.CURDIR}/../libi386
29CFLAGS.gfx_fb.c += -I$(SRCTOP)/sys/teken
30CFLAGS.gfx_fb.c += -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4
31CFLAGS.gfx_fb.c += -I${SRCTOP}/contrib/pnglite
32CFLAGS.gfx_fb.c += -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
33
34# Include bcache code.
35HAVE_BCACHE=	yes
36
37# Enable PnP and ISA-PnP code.
38HAVE_PNP=	yes
39HAVE_ISABUS=	yes
40
41.if ${MK_LOADER_FIREWIRE} == "yes"
42CFLAGS+=	-DLOADER_FIREWIRE_SUPPORT
43LIBFIREWIRE=	${BOOTOBJ}/i386/libfirewire/libfirewire.a
44.endif
45
46.if ${MK_LOADER_ZFS} == "yes"
47CFLAGS.main.c+=	-I${SYSDIR}/contrib/openzfs/include
48CFLAGS.main.c+=	-I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs
49.endif
50
51.if exists(${.CURDIR}/help.i386)
52HELP_FILES=	${.CURDIR}/help.i386
53.endif
54
55# Always add MI sources
56.include	"${BOOTSRC}/loader.mk"
57
58CLEANFILES+=	${LOADER} ${LOADER}.bin 8x16.c
59
60ORG=		0x0
61
62CFLAGS+=	-Wall
63LDFLAGS+=	-static ${LDFLAGS_ORG} -Wl,--gc-sections
64
65# i386 standalone support library
66LIBI386=	${BOOTOBJ}/i386/libi386/libi386.a
67CFLAGS+=	-I${BOOTSRC}/i386
68
69# Debug me!
70#CFLAGS+=	-g
71#LDFLAGS+=	-g
72
738x16.c: ${SRCTOP}/contrib/terminus/ter-u16v.bdf
74	vtfontcvt -f compressed-source -o ${.TARGET} ${.ALLSRC}
75
76${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
77	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
78		-b ${BTXKERN} ${LOADER}.bin
79
80${LOADER}.bin: ${LOADER}.sym
81	${STRIPBIN} -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
82
83.if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
84LINKS+=		${BINDIR}/${LOADER} ${BINDIR}/zfsloader
85.endif
86.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
87LINKS+=		${BINDIR}/${LOADER} ${BINDIR}/loader
88.endif
89FILES+=	${LOADER}
90FILESMODE_${LOADER}= ${BINMODE} -b
91
92# XXX crt0.o needs to be first for pxeboot(8) to work
93OBJS=	${BTXCRT}
94
95DPADD=	${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32}
96LDADD=	${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32}
97
98.if ${MACHINE_CPUARCH} == "amd64"
99CFLAGS+=	-DLOADER_PREFER_AMD64
100.endif
101
102.include <bsd.prog.mk>
103