# gpSP makefile
# Gilead Kutnick - Exophase
# pandora port - notaz
# Maemo port - Figa, Javispedro, Luiscesjr, Bonapart

# Global definitions

CC        = $(CROSS_COMPILE)gcc

OBJS      = maemo.o main.o cpu.o memory.o video.o input.o sound.o gui.o \
            cheats.o zip.o cpu_threaded.o arm_stub.o video_blend.o warm.o            
BIN       = gpspm

# Platform specific definitions 

VPATH      += .. ../arm
CFLAGS     += -DARM_ARCH -DPND_BUILD -Wall
CFLAGS     += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -ffast-math
CFLAGS     += -ggdb
CFLAGS     += -O2
CFLAGS     += -DMAEMO

# expecting to have PATH set up to get correct sdl-config first
CFLAGS     += `sdl-config --cflags`	-I. $(shell sdl-config --cflags)	$(shell pkg-config --cflags hildon-1)
LIBS       += `sdl-config --libs`	-lz $(shell sdl-config --libs)	-I. $(shell pkg-config --libs hildon-1)
LIBS       += -ldl -lpthread -lz 

# Compilation:

all:	$(BIN)

%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

cpu.o cpu_threaded.o: CFLAGS += -Wno-unused-variable -Wno-unused-label

$(BIN): $(OBJS)
	$(CC) $(OBJS) $(LIBS) -o $(BIN)

clean:
	rm -f *.o $(BIN)

# ----------- release -----------

install: gpspm
	install gpspm $(DESTDIR)/opt/gpsp
	install conf.gpsp $(DESTDIR)/opt/gpsp
	install conf_ps.gpsp $(DESTDIR)/opt/gpsp
	install game_config.txt $(DESTDIR)/opt/gpsp


rel: gpsp gpsp.sh gpsp.pxml gba_icon.png readme.txt ../game_config.txt ../COPYING.DOC
	rm -rf out
	mkdir out
	cp $^ out/

