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