Makefile revision 260096
1# $FreeBSD: stable/10/sys/boot/pc98/boot2/Makefile 260096 2013-12-30 20:15:46Z dim $ 2 3.include <bsd.own.mk> 4 5# XXX: clang can compile the boot code just fine, but boot2 gets too big 6CC:= gcc 7COMPILER_TYPE:= gcc 8 9FILES= boot boot1 boot2 10 11NM?= nm 12 13BOOT_COMCONSOLE_PORT?= 0x238 14BOOT_COMCONSOLE_SPEED?= 9600 15B2SIOFMT?= 0x3 16 17REL1= 0x700 18ORG1= 0 19ORG2= 0x2000 20 21# Decide level of UFS support. 22BOOT2_UFS?= UFS1_AND_UFS2 23#BOOT2_UFS?= UFS2_ONLY 24#BOOT2_UFS?= UFS1_ONLY 25 26CFLAGS= -Os \ 27 -fno-guess-branch-probability \ 28 -fomit-frame-pointer \ 29 -fno-unit-at-a-time \ 30 -mno-align-long-strings \ 31 -mrtd \ 32 -mregparm=3 \ 33 -D${BOOT2_UFS} \ 34 -DFLAGS=${BOOT_BOOT1_FLAGS} \ 35 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ 36 -DSIOFMT=${B2SIOFMT} \ 37 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ 38 -I${.CURDIR}/../../.. \ 39 -I${.CURDIR}/../../i386/boot2 \ 40 -I${.CURDIR}/../../common \ 41 -I${.CURDIR}/../btx/lib -I. \ 42 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 43 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 44 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ 45 -Winline --param max-inline-insns-single=100 46 47# Set machine type to PC98_SYSTEM_PARAMETER 48#CFLAGS+= -DSET_MACHINE_TYPE 49 50# Initialize the bi_bios_geom using the BIOS geometry 51#CFLAGS+= -DGET_BIOSGEOM 52 53LDFLAGS=-static -N --gc-sections 54 55# Pick up ../Makefile.inc early. 56.include <bsd.init.mk> 57 58.PATH: ${.CURDIR}/../../i386/boot2 59 60CLEANFILES= boot 61 62boot: boot1 boot2 63 cat boot1 boot2 > boot 64 65CLEANFILES+= boot1 boot1.out boot1.o 66 67boot1: boot1.out 68 objcopy -S -O binary boot1.out ${.TARGET} 69 70boot1.out: boot1.o 71 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 72 73CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ 74 boot2.s boot2.s.tmp boot2.h sio.o 75 76boot2: boot2.ld 77 @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \ 78 echo "$$x bytes available"; test $$x -ge 0 79 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 80 81boot2.ld: boot2.ldr boot2.bin ${BTXKERN} 82 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \ 83 -o ${.TARGET} -P 1 boot2.bin 84 85boot2.ldr: 86 dd if=/dev/zero of=${.TARGET} bs=276 count=1 87 88boot2.bin: boot2.out 89 objcopy -S -O binary boot2.out ${.TARGET} 90 91boot2.out: ${BTXCRT} boot2.o sio.o 92 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 93 94boot2.o: boot2.s 95 96SRCS= boot2.c boot2.h 97 98boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c 99 ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c 100 sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 101 rm -f boot2.s.tmp 102 103boot2.h: boot1.out 104 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T (read|putc)/ \ 105 { x = $$1 - ORG1; \ 106 printf("#define %sORG %#x\n", toupper($$3), REL1 + x) }' \ 107 ORG1=`printf "%d" ${ORG1}` \ 108 REL1=`printf "%d" ${REL1}` > ${.TARGET} 109 110.include <bsd.prog.mk> 111