Makefile revision 272250
1# $FreeBSD: head/sys/boot/pc98/boot2/Makefile 272250 2014-09-28 12:13:51Z nyan $ 2 3.include <bsd.own.mk> 4 5FILES= boot boot1 boot2 6 7NM?= nm 8 9BOOT_COMCONSOLE_PORT?= 0x238 10BOOT_COMCONSOLE_SPEED?= 9600 11B2SIOFMT?= 0x3 12 13REL1= 0x700 14ORG1= 0 15ORG2= 0x2000 16 17# Decide level of UFS support. 18BOOT2_UFS?= UFS1_AND_UFS2 19#BOOT2_UFS?= UFS2_ONLY 20#BOOT2_UFS?= UFS1_ONLY 21 22CFLAGS= -Os \ 23 -fomit-frame-pointer \ 24 -mrtd \ 25 -mregparm=3 \ 26 -D${BOOT2_UFS} \ 27 -DFLAGS=${BOOT_BOOT1_FLAGS} \ 28 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ 29 -DSIOFMT=${B2SIOFMT} \ 30 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ 31 -I${.CURDIR}/../../.. \ 32 -I${.CURDIR}/../../i386/boot2 \ 33 -I${.CURDIR}/../../common \ 34 -I${.CURDIR}/../btx/lib -I. \ 35 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 36 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 37 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ 38 -Winline 39 40CFLAGS.gcc+= -fno-guess-branch-probability \ 41 -fno-unit-at-a-time \ 42 -mno-align-long-strings \ 43 --param max-inline-insns-single=100 44 45# Set machine type to PC98_SYSTEM_PARAMETER 46#CFLAGS+= -DSET_MACHINE_TYPE 47 48# Initialize the bi_bios_geom using the BIOS geometry 49#CFLAGS+= -DGET_BIOSGEOM 50 51CFLAGS.clang+=${CLANG_OPT_SMALL} 52 53LD_FLAGS=-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} ${LD_FLAGS} -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} ${LD_FLAGS} -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 112# XXX: clang integrated-as doesn't grok .codeNN directives yet 113CFLAGS.boot1.S= ${CLANG_NO_IAS} 114CFLAGS+= ${CFLAGS.${.IMPSRC:T}} 115