# Makefile to compile the emulator for Amiga using the SAS
# compiler

CPUOBJS=cpu.o #cpu_m68k.o

# Set to CPUASS if the asm version of cpu emulation should be used
CPUDEF= #CPUASS

AMIGAOBJS=atari_amiga.o amiga/async.o amiga/amiga_asm.o amiga/support.o

OBJS=antic.o atari.o ataripcx.o binload.o compfile.o devices.o gtia.o \
     list.o log.o memory-d.o monitor.o pia.o pokey.o pokeysnd.o prompts.o \
     rt-config.o sio.o statesav.o supercart.o ui.o

Atari800: config.h ${AMIGAOBJS} $(OBJS) ${CPUOBJS}
   sc link to Atari800 with <<
${AMIGAOBJS} $(OBJS) ${CPUOBJS}
<

config.h: config.h.amiga
   copy config.h.amiga config.h

#
# Amiga related files
#

atari_amiga.o: atari_amiga.c atari.h colours.h

amiga/async.o: amiga/async.c amiga/async.h

amiga/amiga_asm.o: amiga/amiga_asm.asm
  PhxAss amiga/amiga_asm.asm m=68020 OPT=! To=$@

amiga/support.o: amiga/support.c amiga/support.h

#
# The emulator files
#

antic.o: antic.c atari.h rt-config.h cpu.h gtia.h antic.h

atari.o: atari.c

ataripcx.o: ataripcx.c ataripcx.h

binload.o: binload.c

compfile.o: compfile.c

devices.o: devices.c atari.h cpu.h devices.h rt-config.h

gtia.o: gtia.c atari.h cpu.h pia.h pokey.h gtia.h antic.h platform.h

list.o: list.c list.h

log.o: log.c log.h

memory-d.o : memory-d.c memory-d.h

monitor.o: monitor.c atari.h cpu.h antic.h gtia.h

pia.o: pia.c atari.h cpu.h pia.h platform.h

pokey.o: pokey.c atari.h pia.h pokey.h gtia.h sio.h platform.h

pokeysnd.o: pokeysnd.c pokeysnd.h

prompts.o: prompts.c prompts.h
  
rt-config.o: rt-config.c atari.h prompts.h

sio.o: sio.c atari.h cpu.h sio.h

statesav.o: statesav.c statesav.h

supercart.o: supercart.c atari.h cpu.h

ui.o: ui.c rt-config.h atari.h cpu.h gtia.h sio.h list.h \
      atari.h

# The cpu modules

cpu.o: cpu.c
   sc cpu.c verbose DEF=${CPUDEF}

cpu_m68k.o: cpu_m68k.s
   phxass cpu_m68k.s m=68020 OPT=0 DS DL SET=AMIGA To=$@

clean:
   -delete *.o
   -delete amiga/*.o

install-at:
   copy Atari800 dh2:projects/Atari/Atari800
