Makefile revision 40308
1#	$Id: Makefile,v 1.1.1.1 1998/10/12 21:16:26 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 ${.TARGET} -P 1 boot2.bin
36	@ls -l boot2 | awk '{ x = 7680 - $$5; print x " bytes free"; \
37		if (x < 0) exit 1 }'
38
39boot2.ldr:
40	dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null
41
42boot2.bin: boot2.out
43	objcopy -S -O binary boot2.out ${.TARGET}
44
45boot2.out: boot2.o
46	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \
47		${BTX}/lib/crt0.o boot2.o
48
49clean:
50	rm -f boot1 boot1.out boot1.o boot2 boot2.ldr boot2.bin \
51		boot2.out boot2.o
52