Makefile revision 40314
1# $Id: Makefile,v 1.2 1998/10/13 18:29:18 rnordier Exp $ 2 3M4?= m4 4 5.if exists(${.OBJDIR}/../btx) 6BTX= ${.OBJDIR}/../btx 7.else 8BTX= ${.CURDIR}/../btx 9.endif 10 11ORG1= 0x7c00 12ORG2= 0x1000 13 14CFLAGS= -elf -I${BTX}/lib -I. -fno-builtin \ 15 -O2 -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mrtd \ 16 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 17 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 18 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings 19 20LDFLAGS=-nostdlib -static -N 21 22all: boot1 boot2 23 24boot1: boot1.out 25 objcopy -S -O binary boot1.out ${.TARGET} 26 27boot1.out: boot1.o 28 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o 29 30boot1.o: boot1.m4 boot1.s 31 ${M4} boot1.m4 boot1.s | ${AS} ${AFLAGS} -o ${.TARGET} 32 33boot2: boot2.ldr boot2.bin 34 btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ 35 -o boot2.ld -P 1 boot2.bin 36 @ls -l boot2.ld | awk '{ x = 7680 - $$5; \ 37 print x " bytes available"; if (x < 0) exit 1 }' 38 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null 39 40boot2.ldr: 41 dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null 42 43boot2.bin: boot2.out 44 objcopy -S -O binary boot2.out ${.TARGET} 45 46boot2.out: boot2.o 47 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ 48 ${BTX}/lib/crt0.o boot2.o 49 50clean: 51 rm -f boot1 boot1.out boot1.o boot2 boot2.ldr boot2.bin \ 52 boot2.ld boot2.out boot2.o 53