Makefile revision 213568
1# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 213568 2010-10-08 10:27:52Z pho $
2
3.PATH:		${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common
4
5FILES=		gptboot
6
7NM?=		nm
8
9BOOT_COMCONSOLE_PORT?= 0x3f8
10BOOT_COMCONSOLE_SPEED?= 9600
11B2SIOFMT?=	0x3
12
13REL1=	0x700
14ORG1=	0x7c00
15ORG2=	0x0
16
17# Decide level of UFS support.
18GPTBOOT_UFS?=	UFS1_AND_UFS2
19#GPTBOOT_UFS?=	UFS2_ONLY
20#GPTBOOT_UFS?=	UFS1_ONLY
21
22CFLAGS=	-DBOOTPROG=\"gptboot\" \
23	-Os \
24	-fno-guess-branch-probability \
25	-fomit-frame-pointer \
26	-fno-unit-at-a-time \
27	-mno-align-long-strings \
28	-mrtd \
29	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
30	-DGPT \
31	-D${GPTBOOT_UFS} \
32	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
33	-DSIOFMT=${B2SIOFMT} \
34	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
35	-I${.CURDIR}/../../common \
36	-I${.CURDIR}/../common \
37	-I${.CURDIR}/../btx/lib -I. \
38	-I${.CURDIR}/../boot2 \
39	-I${.CURDIR}/../../.. \
40	-Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
41	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
42	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
43	-Winline --param max-inline-insns-single=100
44
45LDFLAGS=-static -N --gc-sections
46
47# Pick up ../Makefile.inc early.
48.include <bsd.init.mk>
49
50CLEANFILES=	gptboot
51
52gptboot: gptldr.bin gptboot.bin ${BTXKERN}
53	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
54	    -o ${.TARGET} gptboot.bin
55
56CLEANFILES+=	gptldr.bin gptldr.out gptldr.o
57
58gptldr.bin: gptldr.out
59	objcopy -S -O binary gptldr.out ${.TARGET}
60
61gptldr.out: gptldr.o
62	${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
63
64CLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o ufsread.o
65
66gptboot.bin: gptboot.out
67	objcopy -S -O binary gptboot.out ${.TARGET}
68
69gptboot.out: ${BTXCRT} gptboot.o sio.o gpt.o crc32.o drv.o cons.o util.o
70	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
71
72gptboot.o: ${.CURDIR}/../../common/ufsread.c
73
74.if ${MACHINE_CPUARCH} == "amd64"
75beforedepend gptboot.o: machine
76CLEANFILES+=	machine
77machine:
78	ln -sf ${.CURDIR}/../../../i386/include machine
79.endif
80
81.include <bsd.prog.mk>
82