# Makefile for PSP MediaCenter
PSPSDK=$(shell psp-config --pspsdk-path)
PSP_EBOOT = EBOOT.PBP
PSPBIN = $(PSPSDK)/../bin
TARGET = program

# EBOOT.PBP Settings, to save hand editing
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = program
PSP_EBOOT_ICON = ICON1.PNG

# Work thru the codecs, and sort out settings
PSPMC_BASE = ./
include codec.conf

INCDIR = sge
LIBDIR = sge
JOY = NO
CFLAGS = -Wno-long-long -O2 -G0 -DJOY_$(JOY)
# Now postprocess the values
OBJS := program.o subprogram.o imageviewer.o calendar.o calculator.o addressbook.o clock.o $(PSP_OBJS)
LIBS = $(PLAYER_LIBS) -lpspaudiolib  -lpspaudio -lpsphprm -lpspusb -lpspusbstor -lpsputility -lstdc++ -lSDL_image -lSDL_gfx -lSDL_ttf -lfreetype -lpng -lz -ljpeg -lSGE -lm $(shell $(PSPBIN)/sdl-config --libs)
# Take cflags and ldflags from codec script and add them in
CFLAGS  := -G0 $(PSP_CFLAGS) $(CFLAGS)
CFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
#CXXFLAGS := $(CFLAGS) -fno-exceptions -fno-rtti
CXXFLAGS := $(CFLAGS)
#ASFLAGS := $(CFLAGS)
LDFLAGS := $(LDFLAGS) $(PSP_LDFLAGS)
EXTRA_TARGETS := header EBOOT.PBP
#USE_PSPSDK_LIBC = 1


# This must be included here
include $(PSPSDK)/lib/build.mak

# Now our own build targets
#deps: 


cleanall:
	rm -f *.elf *.o *.a $(PSP_EBOOT) $(FINAL_TARGET) 
cleanup:
	@find -name "*.bak" -exec rm -f {} \;
	@find -name "*.?~" -exec rm -f {} \;

indent:
	@find -name "*.[h|c]" -exec indent -kr -l120 '{}' \;

# Generate the headerfile for included codecs
header:
	@echo Generating Header
	@rm -rf codecincs.h
	@echo /*Generated by makefile, do not hand edit!!!*/ > codecincs.h
	@echo -e $(PSP_CODEC_INCLUDE) >> codecincs.h


	
