xref: /freebsd/stand/i386/isoboot/Makefile (revision c1418270b28edf9b99044181e9f48dfc0a7dc160)
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
11NM?=		nm
12
13BOOT_COMCONSOLE_PORT?= 0x3f8
14BOOT_COMCONSOLE_SPEED?= 9600
15B2SIOFMT?=	0x3
16
17REL1=	0x700
18ORG1=	0x7c00
19ORG2=	0x0
20
21ISOBOOTSIZE?=	30720
22
23CFLAGS+=-DBOOTPROG=\"isoboot\" \
24	-O1 \
25	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
26	-DSIOFMT=${B2SIOFMT} \
27	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
28	-I${LDRSRC} \
29	-I${BOOTSRC}/i386/common \
30	-I${BOOTSRC}/i386/boot2 \
31	-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
32	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
33	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
34	-Winline -Wno-pointer-sign
35
36CFLAGS.gcc+=	--param max-inline-insns-single=100
37.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
38CFLAGS.gcc+=	-Wno-uninitialized
39.endif
40CFLAGS.clang+=  -Oz ${CLANG_OPT_SMALL}
41
42LD_FLAGS+=${LD_FLAGS_BIN}
43
44CLEANFILES+=	isoboot
45
46isoboot: gptldr.bin isoboot.bin ${BTXKERN}
47	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
48	    -o ${.TARGET} isoboot.bin
49	@set -- `ls -l ${.TARGET}`; x=$$((${ISOBOOTSIZE}-$$5)); \
50	    echo "$$x bytes available"; test $$x -ge 0
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+=	isoboot.bin isoboot.out isoboot.o sio.o crc32.o drv.o \
61		cons.o ${OPENCRYPTO_XTS}
62
63isoboot.bin: isoboot.out
64	${OBJCOPY} -S -O binary isoboot.out ${.TARGET}
65
66isoboot.out: ${BTXCRT} isoboot.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