]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/boot/i386/gptzfsboot/Makefile
MFC r308089: zfsbootcfg: a simple tool to set next boot (one time)
[FreeBSD/FreeBSD.git] / sys / boot / i386 / gptzfsboot / Makefile
1 # $FreeBSD$
2
3 .PATH:          ${.CURDIR}/../boot2 ${.CURDIR}/../gptboot \
4                 ${.CURDIR}/../zfsboot ${.CURDIR}/../common \
5                 ${.CURDIR}/../../common
6
7 FILES=          gptzfsboot
8 MAN=            gptzfsboot.8
9
10 NM?=            nm
11
12 BOOT_COMCONSOLE_PORT?= 0x3f8
13 BOOT_COMCONSOLE_SPEED?= 9600
14 B2SIOFMT?=      0x3
15
16 REL1=   0x700
17 ORG1=   0x7c00
18 ORG2=   0x0
19
20 CFLAGS= -DBOOTPROG=\"gptzfsboot\" \
21         -O1 \
22         -DGPT -DZFS -DBOOT2 \
23         -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
24         -DSIOFMT=${B2SIOFMT} \
25         -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
26         -I${.CURDIR}/../../common \
27         -I${.CURDIR}/../common \
28         -I${.CURDIR}/../../zfs \
29         -I${.CURDIR}/../../../cddl/boot/zfs \
30         -I${.CURDIR}/../btx/lib -I. \
31         -I${.CURDIR}/../boot2 \
32         -I${.CURDIR}/../../.. \
33         -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
34         -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
35         -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
36         -Winline
37
38 .if !defined(LOADER_NO_GELI_SUPPORT)
39 CFLAGS+=        -DLOADER_GELI_SUPPORT
40 CFLAGS+=        -I${.CURDIR}/../../geli
41 LIBGELIBOOT=    ${.OBJDIR}/../../geli/libgeliboot.a
42 .PATH:          ${.CURDIR}/../../../opencrypto
43 OPENCRYPTO_XTS= xform_aes_xts.o
44 .endif
45
46 CFLAGS.gcc+=    --param max-inline-insns-single=100
47
48 LD_FLAGS=-static -N --gc-sections
49
50 LIBSTAND=       ${.OBJDIR}/../../libstand32/libstand.a
51
52 # Pick up ../Makefile.inc early.
53 .include <bsd.init.mk>
54
55 CLEANFILES=     gptzfsboot
56
57 gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
58         btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
59             -o ${.TARGET} gptzfsboot.bin
60
61 CLEANFILES+=    gptldr.bin gptldr.out gptldr.o
62
63 gptldr.bin: gptldr.out
64         ${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
65
66 gptldr.out: gptldr.o
67         ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
68
69 CLEANFILES+=    gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o cons.o \
70                 drv.o gpt.o util.o ${OPENCRYPTO_XTS}
71
72 gptzfsboot.bin: gptzfsboot.out
73         ${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET}
74
75 gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o ${OPENCRYPTO_XTS}
76         ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} ${LIBGELIBOOT}
77
78 zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c
79
80 .if ${MACHINE_CPUARCH} == "amd64"
81 beforedepend zfsboot.o: machine
82 CLEANFILES+=    machine
83 machine: .NOMETA
84         ln -sf ${.CURDIR}/../../../i386/include machine
85 .endif
86
87 .include <bsd.prog.mk>
88
89 # XXX: clang integrated-as doesn't grok .codeNN directives yet
90 CFLAGS.gptldr.S=        ${CLANG_NO_IAS}