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