Makefile revision 308915
1# $FreeBSD: stable/10/sys/boot/i386/zfsboot/Makefile 308915 2016-11-21 10:14:36Z avg $ 2 3.PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common 4 5FILES= zfsboot 6MAN= zfsboot.8 7 8NM?= nm 9 10BOOT_COMCONSOLE_PORT?= 0x3f8 11BOOT_COMCONSOLE_SPEED?= 9600 12B2SIOFMT?= 0x3 13 14REL1= 0x700 15ORG1= 0x7c00 16ORG2= 0x2000 17 18CFLAGS= -DBOOTPROG=\"zfsboot\" \ 19 -O1 \ 20 -DZFS -DBOOT2 \ 21 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ 22 -DSIOFMT=${B2SIOFMT} \ 23 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ 24 -I${.CURDIR}/../../common \ 25 -I${.CURDIR}/../common \ 26 -I${.CURDIR}/../../zfs \ 27 -I${.CURDIR}/../../../cddl/boot/zfs \ 28 -I${.CURDIR}/../btx/lib -I. \ 29 -I${.CURDIR}/../boot2 \ 30 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 31 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 32 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ 33 -Winline 34 35CFLAGS.gcc+= --param max-inline-insns-single=100 36 37LD_FLAGS=-static -N --gc-sections 38 39LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a 40 41# Pick up ../Makefile.inc early. 42.include <bsd.init.mk> 43 44CLEANFILES= zfsboot 45 46zfsboot: zfsboot1 zfsboot2 47 cat zfsboot1 zfsboot2 > zfsboot 48 49CLEANFILES+= zfsboot1 zfsldr.out zfsldr.o 50 51zfsboot1: zfsldr.out 52 ${OBJCOPY} -S -O binary zfsldr.out ${.TARGET} 53 54zfsldr.out: zfsldr.o 55 ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} zfsldr.o 56 57CLEANFILES+= zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \ 58 zfsboot.o zfsboot.s zfsboot.s.tmp sio.o cons.o drv.o util.o 59 60# We currently allow 65536 bytes for zfsboot - in practice it could be 61# any size up to 3.5Mb but keeping it fixed size simplifies zfsldr. 62# 63BOOT2SIZE= 65536 64 65zfsboot2: zfsboot.ld 66 @set -- `ls -l zfsboot.ld`; x=$$((${BOOT2SIZE}-$$5)); \ 67 echo "$$x bytes available"; test $$x -ge 0 68 dd if=zfsboot.ld of=${.TARGET} obs=${BOOT2SIZE} conv=osync 69 70zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN} 71 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \ 72 -o ${.TARGET} -P 1 zfsboot.bin 73 74zfsboot.ldr: 75 cp /dev/null ${.TARGET} 76 77zfsboot.bin: zfsboot.out 78 ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET} 79 80zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o 81 ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} 82 83SRCS= zfsboot.c 84 85.if ${MACHINE_CPUARCH} == "amd64" 86beforedepend zfsboot.o: machine 87CLEANFILES+= machine 88machine: 89 ln -sf ${.CURDIR}/../../../i386/include machine 90.endif 91 92.include <bsd.prog.mk> 93 94# XXX: clang integrated-as doesn't grok .codeNN directives yet 95CFLAGS.zfsldr.S= ${CLANG_NO_IAS} 96CFLAGS+= ${CFLAGS.${.IMPSRC:T}} 97