#
# Makefile.in for UAE tools
#

export PATH	:=	$(DEVKITPRO)/MinGW/bin:$(PATH):.


CC        = gcc
LDFLAGS   =
CFLAGS    = -I../include
LIBRARIES =

all: copy gencpu.exe gencomp.exe build68k.exe genblitter.exe genlinetoscr.exe


copy:
	cp ../genblitter.c genblitter.c
	cp ../blitops.c blitops.c
	cp ../writelog.c writelog.c
	cp ../build68k.c build68k.c
	cp ../gencpu.c gencpu.c
	cp ../readcpu.c readcpu.c
	cp ../missing.c missing.c
	cp ../gencomp.c gencomp.c
	cp ../genlinetoscr.c genlinetoscr.c
	cp ../cpudefs.c cpudefs.c


install:


clean:
	-rm -f *.o
	-rm cpudefs.c
	-rm -f gencpu.exe gencomp.exe build68k.exe genblitter.exe genlinetoscr.exe genblitter.c blitops.c writelog.c build68k.c gencpu.c readcpu.c missing.c gencomp.c genlinetoscr.c cpudefs.c


distclean: clean
	-rm -f config.cache config.log config.status
	-rm -f Makefile sysconfig.h
	-rm -f *.c

genblitter.exe: genblitter.o blitops.o writelog.o
	$(CC) $(LDFLAGS) -o genblitter.exe genblitter.o blitops.o writelog.o
build68k.exe: build68k.o writelog.o
	$(CC) $(LDFLAGS) -o build68k.exe build68k.o writelog.o
gencpu.exe: gencpu.o readcpu.o cpudefs.o missing.o writelog.o
	$(CC) $(LDFLAGS) -o gencpu.exe gencpu.o readcpu.o cpudefs.o missing.o writelog.o
gencomp.exe: gencomp.o readcpu.o cpudefs.o missing.o
	$(CC) $(LDFLAGS) -o gencomp.exe gencomp.o readcpu.o missing.o cpudefs.o writelog.o
genlinetoscr.exe: genlinetoscr.o
	$(CC) $(LDFLAGS) -o genlinetoscr.exe genlinetoscr.o

custom.o: blit.h
drawing.o: linetoscr.c

cpudefs.c: build68k.exe ../table68k
	build68k.exe < ../table68k >cpudefs.c

.c.o:
	$(CC) $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(CFLAGS_$@) $< -o $@
.c.s:
	$(CC) $(INCLUDES) -S $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $< -o $@
.c.i:
	$(CC) $(INCLUDES) -E $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $< > $@
