Makefile revision 344399
1# $FreeBSD: stable/11/stand/i386/gptboot/Makefile 344399 2019-02-20 23:55:35Z kevans $
2
3.include <bsd.init.mk>
4
5.PATH:		${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${SASRC}
6
7FILES=		gptboot
8MAN=		gptboot.8
9
10BOOT_COMCONSOLE_PORT?= 0x3f8
11BOOT_COMCONSOLE_SPEED?= 9600
12B2SIOFMT?=	0x3
13
14REL1=	0x700
15ORG1=	0x7c00
16ORG2=	0x0
17
18# Decide level of UFS support.
19GPTBOOT_UFS?=	UFS1_AND_UFS2
20#GPTBOOT_UFS?=	UFS2_ONLY
21#GPTBOOT_UFS?=	UFS1_ONLY
22
23CFLAGS+=-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${LDRSRC} \
31	-I${BOOTSRC}/i386/common \
32	-I${BOOTSRC}/i386/boot2 \
33	-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
34	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
35	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
36	-Wno-pointer-sign
37
38CFLAGS.gcc+=	--param max-inline-insns-single=100
39
40LD_FLAGS+=${LD_FLAGS_BIN}
41
42CLEANFILES+=	gptboot
43
44gptboot: gptldr.bin gptboot.bin ${BTXKERN}
45	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
46	    -o ${.TARGET} gptboot.bin
47
48CLEANFILES+=	gptldr.bin gptldr.out gptldr.o
49
50gptldr.bin: gptldr.out
51	${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
52
53gptldr.out: gptldr.o
54	${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
55
56CLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o crc32.o drv.o \
57		cons.o ${OPENCRYPTO_XTS}
58
59gptboot.bin: gptboot.out
60	${OBJCOPY} -S -O binary gptboot.out ${.TARGET}
61
62gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o ${OPENCRYPTO_XTS}
63	${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
64
65.include <bsd.prog.mk>
66
67# XXX: clang integrated-as doesn't grok .codeNN directives yet
68CFLAGS.gptldr.S=	${CLANG_NO_IAS}
69