CC = m68k-rtems4.11-gcc
AS = m68k-rtems4.11-as
AR = m68k-rtems4.11-ar
LD = m68k-rtems4.11-ld

OBJDUMP = m68k-rtems4.11-objdump
OBJCOPY = m68k-rtems4.11-objcopy

all : test.S19 test.dis

crt0.o : crt0.S Makefile 
	m68k-rtems4.11-gcc -c -o crt0.o -m68000 crt0.S

test.o : test.c Makefile
	$(CC) test.c -o test.o -c -m68000 -fomit-frame-pointer

test.x : test.o crt0.o ldscript.ld Makefile
	$(LD) -Map test.map crt0.o test.o  -Tldscript.ld -v -nostartfiles -o test.x 

test.S19 : test.x Makefile
	$(OBJCOPY) -O srec test.x test.S19

test.dis : test.x Makefile
	$(OBJDUMP) -d test.o > test.dis

crt0.dis : crt0.o Makefile
	$(OBJDUMP) -d crt0.o > crt0.dis

download: test.S19
	/media/disk/Projects/microrom/sw/microrom test.S19 -s -e512 -rl

clean :
	rm *.o
	rm *.x
	rm *.dis
	rm *.map