Makefile revision 225530
150477Speter# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 225530 2011-09-13 14:03:55Z avg $
240269Srnordier
3213136Spjd.PATH:		${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common
440326Srnordier
5172940SjhbFILES=		gptboot
6172940Sjhb
780751SjhbNM?=		nm
880751Sjhb
942480SrnordierBOOT_COMCONSOLE_PORT?= 0x3f8
1042480SrnordierBOOT_COMCONSOLE_SPEED?= 9600
1140541SrnordierB2SIOFMT?=	0x3
1240541Srnordier
13104673SgreenREL1=	0x700
1440269SrnordierORG1=	0x7c00
15172940SjhbORG2=	0x0
1640269Srnordier
17125537Sru# Decide level of UFS support.
18172940SjhbGPTBOOT_UFS?=	UFS1_AND_UFS2
19172940Sjhb#GPTBOOT_UFS?=	UFS2_ONLY
20172940Sjhb#GPTBOOT_UFS?=	UFS1_ONLY
21104635Sphk
22213136SpjdCFLAGS=	-DBOOTPROG=\"gptboot\" \
23225530Savg	-O1 \
24213136Spjd	-DGPT \
25172940Sjhb	-D${GPTBOOT_UFS} \
26125932Sru	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
27125932Sru	-DSIOFMT=${B2SIOFMT} \
28125932Sru	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
2997860Sphk	-I${.CURDIR}/../../common \
30213136Spjd	-I${.CURDIR}/../common \
31173026Sjhb	-I${.CURDIR}/../btx/lib -I. \
32172940Sjhb	-I${.CURDIR}/../boot2 \
33213568Spho	-I${.CURDIR}/../../.. \
3440269Srnordier	-Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
3540269Srnordier	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
36169732Skan	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
37169732Skan	-Winline --param max-inline-insns-single=100
3840269Srnordier
39218893Sdim.if ${CC:T:Mclang} == "clang"
40218893Sdim# XXX: clang integrated-as doesn't grok .codeNN directives yet
41218893SdimCFLAGS+=	${.IMPSRC:T:Mgptldr.S:C/^.+$/-no-integrated-as/}
42218893Sdim.endif
43218893Sdim
44125621SruLDFLAGS=-static -N --gc-sections
4540269Srnordier
46125537Sru# Pick up ../Makefile.inc early.
47125537Sru.include <bsd.init.mk>
4840269Srnordier
49172940SjhbCLEANFILES=	gptboot
50125537Sru
51172940Sjhbgptboot: gptldr.bin gptboot.bin ${BTXKERN}
52172940Sjhb	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
53172940Sjhb	    -o ${.TARGET} gptboot.bin
54109886Sphk
55172940SjhbCLEANFILES+=	gptldr.bin gptldr.out gptldr.o
56125537Sru
57172940Sjhbgptldr.bin: gptldr.out
58172940Sjhb	objcopy -S -O binary gptldr.out ${.TARGET}
5940269Srnordier
60172940Sjhbgptldr.out: gptldr.o
61172940Sjhb	${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
6240269Srnordier
63219483SjhbCLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o gpt.o crc32.o drv.o \
64219483Sjhb		cons.o util.o
6596424Speter
66172940Sjhbgptboot.bin: gptboot.out
67172940Sjhb	objcopy -S -O binary gptboot.out ${.TARGET}
6880751Sjhb
69213136Spjdgptboot.out: ${BTXCRT} gptboot.o sio.o gpt.o crc32.o drv.o cons.o util.o
70213136Spjd	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
7140269Srnordier
72172940Sjhbgptboot.o: ${.CURDIR}/../../common/ufsread.c
7380751Sjhb
74211677Simp.if ${MACHINE_CPUARCH} == "amd64"
75172940Sjhbbeforedepend gptboot.o: machine
76125556SruCLEANFILES+=	machine
77116864Spetermachine:
78116864Speter	ln -sf ${.CURDIR}/../../../i386/include machine
79116864Speter.endif
80116864Speter
81125537Sru.include <bsd.prog.mk>
82