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