#***************************************************************************
#*   Copyright (C) 2006 by Dave Parker                                     *
#*   drparker@freenet.co.uk                                                *
#*                                                                         *
#*   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.,                                       *
#*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
#***************************************************************************/

ifdef gp2x
CC=gp2x-g++
AR=gp2x-ar
else
CC=g++
AR=ar
endif

OBJS=screen.o app.o image.o font.o input.o colour.o button.o surface.o menu.o sound.o audioplayer.o fileselector.o music.o

all: libgp2xsdl.a

libgp2xsdl.a: $(OBJS)
	rm -f libgp2xsdl.a
	$(AR) cr libgp2xsdl.a $(OBJS)

surface.o: surface.cpp colour.h surface.h
	$(CC) -c `sdl-config --cflags` surface.cpp

screen.o: screen.cpp screen.h colour.h surface.h
	$(CC) -c `sdl-config --cflags` screen.cpp

app.o: app.cpp app.h impl.h input.h sound.h
	$(CC) -c `sdl-config --cflags` app.cpp

image.o: image.cpp image.h screen.h colour.h
	$(CC) -c `sdl-config --cflags` image.cpp

font.o: font.cpp font.h screen.h
	$(CC) -c `sdl-config --cflags` font.cpp

input.o: input.cpp input.h button.h
	$(CC) -c `sdl-config --cflags` input.cpp

colour.o: colour.cpp colour.h surface.h
	$(CC) -c `sdl-config --cflags` colour.cpp

button.o: button.cpp button.h
	$(CC) -c `sdl-config --cflags` button.cpp

menu.o: menu.cpp menu.h
	$(CC) -c `sdl-config --cflags` menu.cpp

music.o: music.cpp music.h
	$(CC) -c `sdl-config --cflags` music.cpp

sound.o: sound.cpp sound.h
	$(CC) -c `sdl-config --cflags` sound.cpp

audioplayer.o: audioplayer.cpp audioplayer.h surface.h music.h
	$(CC) -c `sdl-config --cflags` audioplayer.cpp

fileselector.o: fileselector.cpp fileselector.h surface.h
	$(CC) -c `sdl-config --cflags` fileselector.cpp


clean:
	rm -f libgp2xsdl.a
	rm -f *.o
