]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/boot/i386/zfsboot/Makefile
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306325, and update
[FreeBSD/FreeBSD.git] / sys / boot / i386 / zfsboot / Makefile
1 # $FreeBSD$
2
3 .PATH:          ${.CURDIR}/../boot2 ${.CURDIR}/../common \
4                 ${.CURDIR}/../../common ${.CURDIR}/../../../crypto/skein
5
6 FILES=          zfsboot
7 MAN=            zfsboot.8
8
9 NM?=            nm
10
11 BOOT_COMCONSOLE_PORT?= 0x3f8
12 BOOT_COMCONSOLE_SPEED?= 9600
13 B2SIOFMT?=      0x3
14
15 REL1=   0x700
16 ORG1=   0x7c00
17 ORG2=   0x2000
18
19 CFLAGS= -DBOOTPROG=\"zfsboot\" \
20         -O1 \
21         -DZFS -DBOOT2 \
22         -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
23         -DSIOFMT=${B2SIOFMT} \
24         -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
25         -I${.CURDIR}/../../common \
26         -I${.CURDIR}/../common \
27         -I${.CURDIR}/../../zfs \
28         -I${.CURDIR}/../../../cddl/boot/zfs \
29         -I${.CURDIR}/../../../crypto/skein \
30         -I${.CURDIR}/../btx/lib -I. \
31         -I${.CURDIR}/../boot2 \
32         -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
33         -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
34         -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
35         -Winline
36
37 CFLAGS.gcc+=    --param max-inline-insns-single=100
38 # Do not unroll skein loops, reduce code size
39 CFLAGS+=        -DSKEIN_LOOP=111
40
41 LD_FLAGS=${LD_FLAGS_BIN}
42
43 LIBSTAND=       ${.OBJDIR}/../../libstand32/libstand.a
44
45 # Pick up ../Makefile.inc early.
46 .include <bsd.init.mk>
47
48 CLEANFILES=     zfsboot
49
50 zfsboot: zfsboot1 zfsboot2
51         cat zfsboot1 zfsboot2 > zfsboot
52
53 CLEANFILES+=    zfsboot1 zfsldr.out zfsldr.o
54
55 zfsboot1: zfsldr.out
56         ${OBJCOPY} -S -O binary zfsldr.out ${.TARGET}
57
58 zfsldr.out: zfsldr.o
59         ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} zfsldr.o
60
61 CLEANFILES+=    zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \
62                 zfsboot.o zfsboot.s zfsboot.s.tmp sio.o cons.o drv.o util.o \
63                 skein.o skein_block.o
64
65 # We currently allow 128k bytes for zfsboot - in practice it could be
66 # any size up to 3.5Mb but keeping it fixed size simplifies zfsldr.
67
68 BOOT2SIZE=      131072
69
70 zfsboot2: zfsboot.ld
71         @set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \
72             echo "$$x bytes available"; test $$x -ge 0
73         ${DD} if=${.ALLSRC} of=${.TARGET} obs=${BOOT2SIZE} conv=osync
74
75 zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN}
76         btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \
77             -o ${.TARGET} -P 1 zfsboot.bin
78
79 zfsboot.ldr:
80         cp /dev/null ${.TARGET}
81
82 zfsboot.bin: zfsboot.out
83         ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET}
84
85 zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o skein.o skein_block.o
86         ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
87
88 SRCS=   zfsboot.c
89
90 .if ${MACHINE_CPUARCH} == "amd64"
91 beforedepend zfsboot.o: machine
92 CLEANFILES+=    machine
93 machine: .NOMETA
94         ln -sf ${.CURDIR}/../../../i386/include machine
95 .endif
96
97 .include <bsd.prog.mk>
98
99 # XXX: clang integrated-as doesn't grok .codeNN directives yet
100 CFLAGS.zfsldr.S=        ${CLANG_NO_IAS}