xref: /freebsd/stand/i386/gptzfsboot/Makefile (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1# $FreeBSD$
2
3.include <bsd.init.mk>
4
5.PATH:		${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \
6		${BOOTSRC}/i386/zfsboot ${BOOTSRC}/i386/common \
7		${BOOTSRC}/common
8
9FILES=		gptzfsboot
10MAN=		gptzfsboot.8
11
12BOOT_COMCONSOLE_PORT?= 0x3f8
13BOOT_COMCONSOLE_SPEED?= 9600
14B2SIOFMT?=	0x3
15
16REL1=	0x700
17ORG1=	0x7c00
18ORG2=	0x0
19
20CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \
21	-O1 \
22	-DBOOT2 \
23	-DLOADER_GPT_SUPPORT \
24	-DLOADER_MBR_SUPPORT \
25	-DLOADER_ZFS_SUPPORT \
26	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
27	-DSIOFMT=${B2SIOFMT} \
28	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
29	-I${LDRSRC} \
30	-I${BOOTSRC}/i386/common \
31	-I${BOOTSRC}/i386/libi386 \
32	-I${ZFSSRC} \
33	-I${SYSDIR}/crypto/skein \
34	-I${SYSDIR}/cddl/boot/zfs \
35	-I${SYSDIR}/contrib/openzfs/include \
36	-I${SYSDIR}/contrib/openzfs/include/os/freebsd/spl \
37	-I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs \
38	-I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \
39	-I${BOOTSRC}/i386/btx/lib \
40	-I${BOOTSRC}/i386/boot2 \
41	-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib \
42	-Wall -Waggregate-return -Wbad-function-cast \
43	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
44	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
45	-Wno-pointer-sign
46
47CFLAGS.clang+=	-Wno-tentative-definition-incomplete-type
48
49NO_WCAST_ALIGN=
50
51CFLAGS.gcc+=	--param max-inline-insns-single=100
52
53LD_FLAGS+=${LD_FLAGS_BIN}
54
55CLEANFILES+=	gptzfsboot
56
57gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
58	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
59	    -o ${.TARGET} gptzfsboot.bin
60
61CLEANFILES+=	gptldr.bin gptldr.out gptldr.o
62
63gptldr.bin: gptldr.out
64	${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
65
66gptldr.out: gptldr.o
67	${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} gptldr.o
68
69OBJS=	zfsboot.o sio.o cons.o bcache.o devopen.o disk.o part.o zfs_cmd.o
70CLEANFILES+=	gptzfsboot.bin gptzfsboot.out ${OBJS} ${OPENCRYPTO_XTS}
71
72# i386 standalone support library
73LIBI386=	${BOOTOBJ}/i386/libi386/libi386.a
74
75gptzfsboot.bin: gptzfsboot.out
76	${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET}
77
78gptzfsboot.out: ${BTXCRT} ${OBJS} \
79	${OPENCRYPTO_XTS}
80	${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBI386} ${LIBSA32}
81
82zfsboot.o: ${ZFSSRC}/zfsimpl.c
83
84.include <bsd.prog.mk>
85