xref: /freebsd/stand/i386/gptzfsboot/Makefile (revision 5ab1c5846ff41be24b1f6beb0317bf8258cd4409)
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		${SASRC}
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	-DGPT -DZFS -DBOOT2 \
23	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
24	-DSIOFMT=${B2SIOFMT} \
25	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
26	-I${LDRSRC} \
27	-I${BOOTSRC}/i386/common \
28	-I${ZFSSRC} \
29	-I${SYSDIR}/crypto/skein \
30	-I${SYSDIR}/cddl/boot/zfs \
31	-I${SYSDIR}/cddl/contrib/opensolaris/uts/common \
32	-I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \
33	-I${BOOTSRC}/i386/btx/lib \
34	-I${BOOTSRC}/i386/boot2 \
35	-Wall -Waggregate-return -Wbad-function-cast \
36	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
37	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
38	-Wno-pointer-sign
39
40CFLAGS.clang+=	-Wno-tentative-definition-incomplete-type
41
42NO_WCAST_ALIGN=
43
44CFLAGS.gcc+=	--param max-inline-insns-single=100
45
46LD_FLAGS+=${LD_FLAGS_BIN}
47
48CLEANFILES+=	gptzfsboot
49
50gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
51	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
52	    -o ${.TARGET} gptzfsboot.bin
53
54CLEANFILES+=	gptldr.bin gptldr.out gptldr.o
55
56gptldr.bin: gptldr.out
57	${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
58
59gptldr.out: gptldr.o
60	${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
61
62CLEANFILES+=	gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o cons.o \
63		drv.o gpt.o ${OPENCRYPTO_XTS}
64
65gptzfsboot.bin: gptzfsboot.out
66	${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET}
67
68gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o \
69	${OPENCRYPTO_XTS}
70	${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
71
72zfsboot.o: ${ZFSSRC}/zfsimpl.c
73
74.include <bsd.prog.mk>
75