Makefile revision 344373
1# $FreeBSD: stable/11/stand/i386/gptboot/Makefile 344373 2019-02-20 18:44:09Z kevans $
2
3HAVE_GELI=		yes
4
5.include <bsd.init.mk>
6
7.PATH:		${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${SASRC}
8
9FILES=		gptboot
10MAN=		gptboot.8
11
12NM?=		nm
13
14BOOT_COMCONSOLE_PORT?= 0x3f8
15BOOT_COMCONSOLE_SPEED?= 9600
16B2SIOFMT?=	0x3
17
18REL1=	0x700
19ORG1=	0x7c00
20ORG2=	0x0
21
22# Decide level of UFS support.
23GPTBOOT_UFS?=	UFS1_AND_UFS2
24#GPTBOOT_UFS?=	UFS2_ONLY
25#GPTBOOT_UFS?=	UFS1_ONLY
26
27CFLAGS+=-DBOOTPROG=\"gptboot\" \
28	-O1 \
29	-DGPT \
30	-D${GPTBOOT_UFS} \
31	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
32	-DSIOFMT=${B2SIOFMT} \
33	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
34	-I${LDRSRC} \
35	-I${BOOTSRC}/i386/common \
36	-I${BOOTSRC}/i386/boot2 \
37	-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
38	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
39	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
40	-Wno-pointer-sign
41
42CFLAGS.gcc+=	--param max-inline-insns-single=100
43
44LD_FLAGS+=${LD_FLAGS_BIN}
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} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
59
60CLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o crc32.o drv.o \
61		cons.o ${OPENCRYPTO_XTS}
62
63gptboot.bin: gptboot.out
64	${OBJCOPY} -S -O binary gptboot.out ${.TARGET}
65
66gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o ${OPENCRYPTO_XTS}
67	${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
68
69.include <bsd.prog.mk>
70
71# XXX: clang integrated-as doesn't grok .codeNN directives yet
72CFLAGS.gptldr.S=	${CLANG_NO_IAS}
73