1# $FreeBSD$ 2 3HAVE_GPT= yes 4 5.include <bsd.init.mk> 6 7.PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \ 8 ${BOOTSRC}/i386/zfsboot ${BOOTSRC}/i386/common \ 9 ${SASRC} 10 11FILES= gptzfsboot 12MAN= gptzfsboot.8 13 14NM?= nm 15 16BOOT_COMCONSOLE_PORT?= 0x3f8 17BOOT_COMCONSOLE_SPEED?= 9600 18B2SIOFMT?= 0x3 19 20REL1= 0x700 21ORG1= 0x7c00 22ORG2= 0x0 23 24CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ 25 -O1 \ 26 -DGPT -DZFS -DBOOT2 \ 27 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ 28 -DSIOFMT=${B2SIOFMT} \ 29 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ 30 -I${LDRSRC} \ 31 -I${BOOTSRC}/i386/common \ 32 -I${ZFSSRC} \ 33 -I${SYSDIR}/cddl/boot/zfs \ 34 -I${BOOTSRC}/i386/btx/lib \ 35 -I${BOOTSRC}/i386/boot2 \ 36 -Wall -Waggregate-return -Wbad-function-cast \ 37 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 38 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ 39 -Winline -Wno-pointer-sign 40 41NO_WCAST_ALIGN= 42 43.if ${COMPILER_TYPE} == "clang" || \ 44 (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201) 45CFLAGS+= -Wno-tentative-definition-incomplete-type 46.endif 47 48.if ${MACHINE} == "amd64" 49LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a 50.else 51LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a 52.endif 53 54CFLAGS.gcc+= --param max-inline-insns-single=100 55 56LD_FLAGS+=${LD_FLAGS_BIN} 57 58CLEANFILES+= gptzfsboot 59 60gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN} 61 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \ 62 -o ${.TARGET} gptzfsboot.bin 63 64CLEANFILES+= gptldr.bin gptldr.out gptldr.o 65 66gptldr.bin: gptldr.out 67 ${OBJCOPY} -S -O binary gptldr.out ${.TARGET} 68 69gptldr.out: gptldr.o 70 ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o 71 72CLEANFILES+= gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o cons.o \ 73 drv.o gpt.o util.o ${OPENCRYPTO_XTS} 74 75gptzfsboot.bin: gptzfsboot.out 76 ${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET} 77 78gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \ 79 ${OPENCRYPTO_XTS} 80 ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBZFSBOOT} ${LIBSA32} 81 82zfsboot.o: ${ZFSSRC}/zfsimpl.c 83 84.include <bsd.prog.mk> 85 86# XXX: clang integrated-as doesn't grok .codeNN directives yet 87CFLAGS.gptldr.S= ${CLANG_NO_IAS} 88