include Makefile.conf

CC = pgcc -V 2.95.2 -warpup
OBJECTS = sope.o init.o dasm.o syscall.o hwr.o gpu.o fileio.o memio.o misc.o pad.o gte.o cdrom.o spu.o vagdepack.o oss.o debugger.o
CFLAGS += -Icpu/${MACHINE}

all: ${OBJECTS}
	${CC} -o ../sope_int_soft.elf ${CFLAGS} ${OBJECTS} ${OPCODES} cpu/generic/libcpu.a renderer/soft/librenderer.a ${LIBS}
	elf2exe2 /sope_int_soft.elf /sope_int_soft.exe
	${CC} -o ../sope_int_mgl.elf ${CFLAGS} ${OBJECTS} ${OPCODES} cpu/generic/libcpu.a renderer/minigl/librenderer.a -lmgl ${LIBS} -ldebug
	elf2exe2 /sope_int_mgl.elf /sope_int_mgl.exe
	${CC} -o ../sope_dyn_soft.elf ${CFLAGS} ${OBJECTS} ${OPCODES} cpu/powerpc/libcpu.a renderer/soft/librenderer.a ${LIBS}
	elf2exe2 /sope_dyn_soft.elf /sope_dyn_soft.exe
	${CC} -o ../sope_dyn_mgl.elf ${CFLAGS} ${OBJECTS} ${OPCODES} cpu/powerpc/libcpu.a renderer/minigl/librenderer.a -lmgl ${LIBS} -ldebug
	elf2exe2 /sope_dyn_mgl.elf /sope_dyn_mgl.exe

clean:
	rm -f core *.o */*.a */*/*.o sope

#Dependencies
cdrom.o: cdrom.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h hwr.h
contrib-main.o: contrib-main.c
contrib-syscall.o: contrib-syscall.c sope.h sope_defs.h \
 cpu/${MACHINE}/machine.h dynrec.h cpu/${MACHINE}/macros.h \
 cpu/${MACHINE}/context.h
dasm.o: dasm.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h tables.h
debugger.o: debugger.c
fileio.o: fileio.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h
gpu.o: gpu.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h gpu.h gpu_types.h \
 renderer.h memio.h gpu_getvars.h gpu_sprites.h gpu_tiles.h \
 gpu_polys.h gpu_lines.h gpu_misc.h
gte.o: gte.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h gte.h gte_alg.h gte_cc.h
hwr.o: hwr.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h hwr.h
init.o: init.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h
memio.o: memio.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h
misc.o: misc.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h
oss.o: oss.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h
pad.o: pad.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h pad.h
sope.o: sope.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h /usr/include/sys/time.h
spu.o: spu.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h hwr.h
syscall.o: syscall.c sope.h sope_defs.h cpu/${MACHINE}/machine.h dynrec.h \
 cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h
vagdepack.o: vagdepack.c sope.h sope_defs.h cpu/${MACHINE}/machine.h \
 dynrec.h cpu/${MACHINE}/macros.h cpu/${MACHINE}/context.h
