# Edit this configuration to match your system. Currently every one of
# these but LD is used directly, but you might as well be complete.

TARGET=sh-elf
DCBASE=/usr/local
CC=$(DCBASE)/bin/$(TARGET)-gcc -ml -O2 -m4-single-only -Wall
LD=$(DCBASE)/bin/$(TARGET)-ld
AS=$(DCBASE)/bin/$(TARGET)-as
AR=$(DCBASE)/bin/$(TARGET)-ar
OBJCOPY=$(DCBASE)/bin/$(TARGET)-objcopy
INCS=-I./include 
LIBS=-L./lib -ldream
OBJS= fmsx.o MSX.o Z80.o Dreamcast.o ay8910.o scc.o mem.o disk.o

all: fmsx.srec fmsx.bin

fmsx.srec: fmsx.elf
	$(OBJCOPY) -O srec fmsx.elf fmsx.srec

fmsx.bin: fmsx.elf
	$(OBJCOPY) -O binary fmsx.elf fmsx.bin

fmsx.elf: $(OBJS)
	$(CC) -Wl,-Ttext,0x8c010000 -o fmsx.elf $(OBJS) $(LIBS)

fmsx.o: fmsx.c 
	$(CC) $(INCS) -c fmsx.c

MSX.o: MSX.c 
	$(CC) $(INCS) -c MSX.c

Z80.o: Z80.c 
	$(CC) $(INCS) -c Z80.c

Dreamcast.o: Dreamcast.c
	$(CC) $(INCS) -c Dreamcast.c

ay8910.o: ay8910.c
	$(CC) $(INCS) -c ay8910.c

scc.o: scc.c
	$(CC) $(INCS) -c scc.c

mem.o: mem.c
	$(CC) $(INCS) -c mem.c

disk.o: disk.c
	$(CC) $(INCS) -c disk.c

aica.o: aica.c
	$(CC) $(INCS) -c aica.c

clean:
	-rm -f *.o *.elf 
