OBJECTS	= font.o GC_Memory.o GC_Time.o GC_Context.o GC_Exception.o GC_Interrupt.o GC_EXI.o GC_Card.o GC_Video.o GC_GP.o GC_AI.o GC_AR.o GC_Debug.o GC_BBA.o


EABI	= D:/GCN/DKGC/lib/
RM	= del
CC	= powerpc-eabi-elf-gcc
AR	= powerpc-eabi-elf-ar
AS	= powerpc-eabi-elf-as

INC	= ../include/

CFLAGS	= -O2 -I ${INC}
AFLAGS	= -Wa,-mregnames

NAME	= GC



all: ${EABI}lib${NAME}.a

clean:
	${RM} ${OBJECTS} ${EABI}lib${NAME}.a


${EABI}lib${NAME}.a: ${OBJECTS}
	${AR} rs $@ $^

font.o: font.s font.bin
	${AS} -o $@ font.s

GC_EXI.o: GC_EXI.s
	${AS} -o $@ GC_EXI.s

GC_Memory.o: GC_Memory.c ${INC}GC_Memory.h ${INC}GC_Types.h
	${CC} -c ${CFLAGS} -o $@ GC_Memory.c ${AFLAGS}

GC_Time.o: GC_Time.c ${INC}GC_Time.h ${INC}GC_Types.h ${INC}GC_Interrupt.h ${INC}GC_Exception.h ${INC}GC_Context.h ${INC}GC_Arch.h
	${CC} -c ${CFLAGS} -o $@ GC_Time.c ${AFLAGS}

GC_Context.o: GC_Context.c ${INC}GC_Context.h ${INC}GC_Types.h ${INC}GC_Exception.h ${INC}GC_Arch.h
	${CC} -c ${CFLAGS} -o $@ GC_Context.c ${AFLAGS}

GC_Exception.o: GC_Exception.c ${INC}GC_Types.h ${INC}GC_Exception.h ${INC}GC_Interrupt.h ${INC}GC_Context.h ${INC}GC_Video.h ${INC}GC_Pad.h ${INC}GC_Debug.h ${INC}GC_Arch.h
	${CC} -c ${CFLAGS} -o $@ GC_Exception.c ${AFLAGS}

GC_Interrupt.o: GC_Interrupt.c ${INC}GC_Types.h ${INC}GC_Interrupt.h ${INC}GC_Memory.h ${INC}GC_Context.h ${INC}GC_Exception.h ${INC}GC_AI.h ${INC}GC_EXI.h ${INC}GC_Arch.h
	${CC} -c ${CFLAGS} -o $@ GC_Interrupt.c ${AFLAGS}

GC_Card.o: GC_Card.c ${INC}GC_Types.h ${INC}GC_Card.h ${INC}GC_EXI.h ${INC}GC_Memory.h ${INC}GC_Time.h ${INC}GC_Video.h ${INC}GC_Interrupt.h ${INC}GC_Exception.h ${INC}GC_Context.h ${INC}GC_Arch.h
	${CC} -c ${CFLAGS} -o $@ GC_Card.c ${AFLAGS}

GC_Video.o: GC_Video.c ${INC}GC_Types.h ${INC}GC_Video.h
	${CC} -c ${CFLAGS} -o $@ GC_Video.c ${AFLAGS}

GC_GP.o: GC_GP.c ${INC}GC_Types.h ${INC}GC_GP.h ${INC}GC_Debug.h
	${CC} -c ${CFLAGS} -o $@ GC_GP.c ${AFLAGS}

GC_AI.o: GC_AI.c ${INC}GC_AI.h
	${CC} -c ${CFLAGS} -o $@ GC_AI.c ${AFLAGS}

GC_AR.o: GC_AR.c ${INC}GC_AR.h ${INC}GC_AI.h
	${CC} -c ${CFLAGS} -o $@ GC_AR.c ${AFLAGS}

GC_Debug.o: GC_Debug.c ${INC}GC_Types.h ${INC}GC_Debug.h ${INC}GC_Video.h
	${CC} -c ${CFLAGS} -o $@ GC_Debug.c ${AFLAGS}

GC_BBA.o: GC_BBA.c ${INC}GC_Types.h ${INC}GC_BBA.h ${INC}GC_Debug.h ${INC}GC_EXI.h
	${CC} -c ${CFLAGS} -o $@ GC_BBA.c ${AFLAGS}