#
# JZINTV port on PSP 
#
# Copyright (C) 2006 Ludovic Jacomme (ludovic.jacomme@gmail.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
TARGET = pspint
PSPSDK = $(shell psp-config --pspsdk-path)
PSPBIN = $(shell psp-config --psp-prefix)/bin
SDL_CONFIG = $(PSPBIN)/sdl-config

OBJS = \
global.o \
psp_sound.o \
psp_main.o \
psp_fmgr.o \
psp_menu.o \
psp_menu_kbd.o \
psp_danzeff.o \
psp_kbd.o \
psp_sdl.o \
psp_battery.o \
psp_menu_set.o \
psp_menu_help.o \
psp_font.o \
\
jzintv.o cfg/cfg.o cfg/usage.o misc/crc32.o misc/crc16.o misc/avl.o misc/ll.o \
plat/plat_lib.o plat/gnu_getopt.o event/event.o \
event/event_tbl.o gfx/gfx.o snd/snd.o mvi/mvi.o \
periph/periph.o cp1600/cp1600.o cp1600/op_decode.o \
cp1600/op_exec.o cp1600/tbl/fn_cond_br.o cp1600/tbl/fn_dir_2op.o \
cp1600/tbl/fn_imm_2op.o cp1600/tbl/fn_impl_1op_a.o cp1600/tbl/fn_impl_1op_b.o \
cp1600/tbl/fn_ind_2op.o cp1600/tbl/fn_reg_1op.o cp1600/tbl/fn_reg_2op.o \
cp1600/tbl/fn_rot_1op.o cp1600/tbl/formats.o cp1600/emu_link.o mem/mem.o \
icart/icart.o icart/icartrom.o icart/icartbin.o icart/icartfile.o stic/stic.o \
pads/pads.o pads/pads_cgc.o pads/pads_cgc_linux.o pads/pads_cgc_win32.o \
pads/pads_intv2pc.o ay8910/ay8910.o ivoice/ivoice.o speed/speed.o file/file.o \
bincfg/bincfg.o bincfg/bincfg_grmr.tab.o bincfg/bincfg_lex.o  bincfg/legacy.o \
gif/gif_enc.o gif/lzw_enc.o demo/demo.o  joy/joy.o serializer/serializer.o

DEFAULT_CFLAGS = $(shell $(SDL_CONFIG) --cflags)

PSP_FW_VERSION=15
PSPINT_VERSION=1.1.0
MORE_CFLAGS = -O3 \
 -DPSPINT_VERSION=\"$(PSPINT_VERSION)\" \
 -DNO_STDIO_REDIRECT
# -DMITSHM 

CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS)
CXXFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS) -fno-exceptions -fno-rtti

LIBS += -lstdc++ -lpsppower -lSDL_image -lSDL -lpng -ljpeg -lpspaudio -lpspgu -lpsphprm -lz -lm

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = PSPINT-v$(PSPINT_VERSION)
PSP_EBOOT_ICON= pspint.png
PSP_EBOOT_PIC1 = pspint-pic.png

include $(PSPSDK)/lib/build.mak

install: kxploit
	cp __SCE__pspint/EBOOT.PBP /media/usbdisk/psp/game150/__SCE__pspint/
	cp %__SCE__pspint/EBOOT.PBP /media/usbdisk/psp/game150/%__SCE__pspint/

realclean:
	/bin/rm -f $(OBJS) EBOOT.PBP PARAM.SFO

