Makefile revision 211677
1# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 211677 2010-08-23 01:42:09Z imp $
2
3.PATH:		${.CURDIR}/../boot2
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=	-Os \
23	-fno-guess-branch-probability \
24	-fomit-frame-pointer \
25	-fno-unit-at-a-time \
26	-mno-align-long-strings \
27	-mrtd \
28	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
29	-D${GPTBOOT_UFS} \
30	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
31	-DSIOFMT=${B2SIOFMT} \
32	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
33	-I${.CURDIR}/../../common \
34	-I${.CURDIR}/../btx/lib -I. \
35	-I${.CURDIR}/../boot2 \
36	-Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
37	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
38	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
39	-Winline --param max-inline-insns-single=100
40
41LDFLAGS=-static -N --gc-sections
42
43# Pick up ../Makefile.inc early.
44.include <bsd.init.mk>
45
46CLEANFILES=	gptboot
47
48gptboot: gptldr.bin gptboot.bin ${BTXKERN}
49	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
50	    -o ${.TARGET} gptboot.bin
51
52CLEANFILES+=	gptldr.bin gptldr.out gptldr.o
53
54gptldr.bin: gptldr.out
55	objcopy -S -O binary gptldr.out ${.TARGET}
56
57gptldr.out: gptldr.o
58	${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
59
60CLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o
61
62gptboot.bin: gptboot.out
63	objcopy -S -O binary gptboot.out ${.TARGET}
64
65gptboot.out: ${BTXCRT} gptboot.o sio.o
66	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
67
68gptboot.o: ${.CURDIR}/../../common/ufsread.c
69
70.if ${MACHINE_CPUARCH} == "amd64"
71beforedepend gptboot.o: machine
72CLEANFILES+=	machine
73machine:
74	ln -sf ${.CURDIR}/../../../i386/include machine
75.endif
76
77.include <bsd.prog.mk>
78