#
# 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 = pspggo
PSPSDK = $(shell psp-config --pspsdk-path)
PSPBIN = $(shell psp-config --psp-prefix)/bin
SDL_CONFIG = $(PSPBIN)/sdl-config
OBJS = \
\
psp_global.o \
psp_main.o \
psp_font.o \
psp_sdl.o \
psp_kbd.o \
psp_battery.o \
psp_fmgr.o \
psp_go.o \
psp_menu.o \
psp_menu_help.o \
\
\
engine/aftermath.o \
engine/board.o \
engine/boardlib.o \
engine/breakin.o \
engine/cache.o \
engine/clock.o \
engine/combination.o \
engine/dragon.o \
engine/endgame.o \
engine/filllib.o \
engine/fuseki.o \
engine/genmove.o \
engine/globals.o \
engine/handicap.o \
engine/hash.o \
engine/influence.o \
engine/interface.o \
engine/matchpat.o \
engine/movelist.o \
engine/move_reasons.o \
engine/optics.o \
engine/oracle.o \
engine/owl.o \
engine/persistent.o \
engine/printutils.o \
engine/readconnect.o \
engine/reading.o \
engine/score.o \
engine/semeai.o \
engine/sgfdecide.o \
engine/sgffile.o \
engine/shapes.o \
engine/showbord.o \
engine/surround.o \
engine/unconditional.o \
engine/utils.o \
engine/value_moves.o \
engine/worm.o \
\
patterns/aa_attackpat.o \
patterns/apatterns.o \
patterns/barriers.o \
patterns/conn.o \
patterns/connections.o \
patterns/dfa.o \
patterns/dpatterns.o \
patterns/endgame.o \
patterns/eyes.o \
patterns/fuseki13.o \
patterns/fuseki19.o \
patterns/fuseki9.o \
patterns/fusekipat.o \
patterns/handipat.o \
patterns/helpers.o \
patterns/influence.o \
patterns/josekidb.o \
patterns/owl_attackpat.o \
patterns/owl_defendpat.o \
patterns/owl_vital_apat.o \
patterns/patterns.o \
patterns/read_attack.o \
patterns/read_defend.o \
patterns/transform.o \
\
sgf/sgfnode.o \
sgf/sgftree.o \
sgf/sgf_utils.o \
\
utils/getopt1.o \
utils/getopt.o \
utils/gg_utils.o \
utils/random.o \
\
psp_play.o

# sgf/sgfgen.o \
# patterns/patlib.o \
# patterns/transpat.o \
# patterns/extract_fuseki.o \
# patterns/joseki.o \
# patterns/mkeyes.o \
# patterns/mkpat.o \

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

MORE_CFLAGS = -DHAVE_CONFIG_H -I. -Ipatterns -Iengine -Iutils -Isgf -g -O3 -Wall

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

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

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = PSPGGO
PSP_EBOOT_ICON= pspggo.png
PSP_EBOOT_PIC1 = pspggo-pic.png

include $(PSPSDK)/lib/build.mak

install: kxploit
	cp __SCE__pspggo/EBOOT.PBP /media/usbdisk/psp/game/__SCE__pspggo/
	cp %__SCE__pspggo/EBOOT.PBP /media/usbdisk/psp/game/%__SCE__pspggo/

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

ctags: 
	ctags *[ch] patterns/*[ch] sgf/*[ch] utils/*[ch] engine/*[ch]
