# 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 -O -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= main.o malloc.o cpu8080.o

all: main.srec main.bin

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

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

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

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

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

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

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

send:
	-dc-tool.exe -t com1 -x main.bin
