xref: /freebsd/stand/i386/isoboot/Makefile (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1# $FreeBSD$
2
3.include <bsd.init.mk>
4
5.PATH:		${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \
6		${BOOTSRC}/i386/common ${SASRC}
7
8FILES=		isoboot
9MAN=		isoboot.8
10
11BOOT_COMCONSOLE_PORT?= 0x3f8
12BOOT_COMCONSOLE_SPEED?= 9600
13B2SIOFMT?=	0x3
14
15REL1=	0x700
16ORG1=	0x7c00
17ORG2=	0x0
18
19ISOBOOTSIZE?=	30720
20
21CFLAGS+=-DBOOTPROG=\"isoboot\" \
22	-O1 \
23	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
24	-DSIOFMT=${B2SIOFMT} \
25	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
26	-I${LDRSRC} \
27	-I${BOOTSRC}/i386/common \
28	-I${BOOTSRC}/i386/boot2 \
29	-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
30	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
31	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
32	-Wno-pointer-sign
33
34CFLAGS.gcc+=	--param max-inline-insns-single=100
35CFLAGS.clang+=  -Oz ${CLANG_OPT_SMALL}
36
37LD_FLAGS+=${LD_FLAGS_BIN}
38
39CLEANFILES+=	isoboot
40
41isoboot: gptldr.bin isoboot.bin ${BTXKERN}
42	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
43	    -o ${.TARGET} isoboot.bin
44	@set -- `ls -l ${.TARGET}`; x=$$((${ISOBOOTSIZE}-$$5)); \
45	    echo "$$x bytes available"; test $$x -ge 0
46
47CLEANFILES+=	gptldr.bin gptldr.out gptldr.o
48
49gptldr.bin: gptldr.out
50	${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
51
52gptldr.out: gptldr.o
53	${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} gptldr.o
54
55CLEANFILES+=	isoboot.bin isoboot.out isoboot.o sio.o drv.o \
56		cons.o ${OPENCRYPTO_XTS}
57
58isoboot.bin: isoboot.out
59	${OBJCOPY} -S -O binary isoboot.out ${.TARGET}
60
61isoboot.out: ${BTXCRT} isoboot.o sio.o drv.o cons.o ${OPENCRYPTO_XTS}
62	${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
63
64.include <bsd.prog.mk>
65