TARGET = snes9xTYL
INCDIR = . psp zlib

#only works well with O2, O3 breaks some io stuff (psp hanging)

CFLAGS= -O3 -G0 -Wall   \
	-DPSP -DPSP_NOTUSE -D__PSP__
	#-g -mno-fp-exceptions -mno-check-zero-division -ffast-math -fstrict-aliasing\	
#	-frename-registers -fschedule-insns2 -fomit-frame-pointer -fforce-addr -fstrict-aliasing \
#	-funroll-loops -fdelete-null-pointer-checks \


CXXFLAGS = -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR = 
LDFLAGS =
#USE_PSPSDK_LIBC=1
LIBS = -lm -lpspaudio -lpspgu -lpsppower -ljpeg


EXTRA_TARGETS = EBOOT.PBP
EXTRA_CLEAN = 
PSP_EBOOT_TITLE = snes9xTYL v0.1
 
# Object files
PSP_OBJECTS=apu.o apudebug.o c4.o c4emu.o cheats.o cheats2.o clip.o cpu.o cpuexec.o cpuops.o data.o\
debug.o dma.o dsp1.o fxdbg.o fxemu.o fxinst.o gfx.o gfx_org.o gfx_psp.o globals.o loadzip.o memmap.o\
ppu.o sa1.o sa1cpu.o sdd1.o sdd1emu.o snaporig.o snapshot.o snes9x.o soundux.o spc700.o srtc.o\
tile.o tile_org.o tile_sw.o tile_psp.o unzip.o 

PLATFORMOBJ   = psp/psp.o psp/config.o psp/psplib.o psp/pg.o \
	psp/filer.o psp/menu.o psp/imageio.o psp/blitter.o psp/img_jpeg.o
	
ZLIBOBJ = zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/gzio.o\
		zlib/uncompr.o zlib/deflate.o zlib/trees.o zlib/zutil.o\
		zlib/inflate.o zlib/infblock.o zlib/inftrees.o zlib/infcodes.o\
		zlib/infutil.o zlib/inffast.o 

OBJS= $(PSP_OBJECTS) $(PLATFORMOBJ) $(ZLIBOBJ) 

# Rules to make libraries


PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

# Dependecies
tile_psp.o: tile_psp.h
gfx_psp.o: tile_psp.h
clean_snes:
	rm $(PSP_OBJECTS) $(PLATFORMOBJ)

	