]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/boot/i386/gptzfsboot/Makefile
MFC Loader Fixes 2017q1: r311458,r312237,r312314,r312374,r312947,r313042,
[FreeBSD/FreeBSD.git] / sys / boot / i386 / gptzfsboot / Makefile
1 # $FreeBSD$
2
3 .include <bsd.own.mk>
4
5 .PATH:          ${.CURDIR}/../boot2 ${.CURDIR}/../gptboot \
6                 ${.CURDIR}/../zfsboot ${.CURDIR}/../common \
7                 ${.CURDIR}/../../common ${.CURDIR}/../../../crypto/skein
8
9 FILES=          gptzfsboot
10 MAN=            gptzfsboot.8
11
12 NM?=            nm
13
14 BOOT_COMCONSOLE_PORT?= 0x3f8
15 BOOT_COMCONSOLE_SPEED?= 9600
16 B2SIOFMT?=      0x3
17
18 REL1=   0x700
19 ORG1=   0x7c00
20 ORG2=   0x0
21
22 CFLAGS= -DBOOTPROG=\"gptzfsboot\" \
23         -O1 \
24         -DGPT -DZFS -DBOOT2 \
25         -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
26         -DSIOFMT=${B2SIOFMT} \
27         -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
28         -I${.CURDIR}/../../common \
29         -I${.CURDIR}/../common \
30         -I${.CURDIR}/../../zfs \
31         -I${.CURDIR}/../../../cddl/boot/zfs \
32         -I${.CURDIR}/../../../crypto/skein \
33         -I${.CURDIR}/../btx/lib -I. \
34         -I${.CURDIR}/../boot2 \
35         -I${.CURDIR}/../../.. \
36         -Wall -Waggregate-return -Wbad-function-cast \
37         -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
38         -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
39         -Winline -Wno-pointer-sign
40
41 NO_WCAST_ALIGN=
42
43 .if ${COMPILER_TYPE} == "clang" || \
44     (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201)
45 CFLAGS+=        -Wno-tentative-definition-incomplete-type
46 .endif
47
48 # Do not unroll skein loops, reduce code size
49 CFLAGS+=        -DSKEIN_LOOP=111
50
51 .if !defined(LOADER_NO_GELI_SUPPORT)
52 CFLAGS+=        -DLOADER_GELI_SUPPORT
53 CFLAGS+=        -I${.CURDIR}/../../geli
54 LIBGELIBOOT=    ${.OBJDIR}/../../geli/libgeliboot.a
55 .PATH:          ${.CURDIR}/../../../opencrypto
56 OPENCRYPTO_XTS= xform_aes_xts.o
57 .endif
58
59 CFLAGS.gcc+=    --param max-inline-insns-single=100
60
61 LD_FLAGS=${LD_FLAGS_BIN}
62
63 LIBSTAND=       ${.OBJDIR}/../../libstand32/libstand.a
64
65 # Pick up ../Makefile.inc early.
66 .include <bsd.init.mk>
67
68 CLEANFILES=     gptzfsboot
69
70 gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
71         btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
72             -o ${.TARGET} gptzfsboot.bin
73
74 CLEANFILES+=    gptldr.bin gptldr.out gptldr.o
75
76 gptldr.bin: gptldr.out
77         ${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
78
79 gptldr.out: gptldr.o
80         ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
81
82 CLEANFILES+=    gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o cons.o \
83                 drv.o gpt.o util.o skein.o skein_block.o ${OPENCRYPTO_XTS}
84
85 gptzfsboot.bin: gptzfsboot.out
86         ${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET}
87
88 gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \
89         skein.o skein_block.o ${OPENCRYPTO_XTS}
90         ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSTAND}
91
92 zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c
93
94 .if ${MACHINE_CPUARCH} == "amd64"
95 beforedepend zfsboot.o: machine
96 CLEANFILES+=    machine
97 machine: .NOMETA
98         ln -sf ${.CURDIR}/../../../i386/include machine
99 .endif
100
101 .include <bsd.prog.mk>
102
103 # XXX: clang integrated-as doesn't grok .codeNN directives yet
104 CFLAGS.gptldr.S=        ${CLANG_NO_IAS}