# Change the CHAINPREFIX variable below to the path of your GPH_SDK directory:
# available for download from: (at time of writing lol)
# linux: https://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,14,384
# windoze: https://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,14,383
CHAINPREFIX=/home/j0e/junkyard/wiz/sdks/GPH_SDK

CC=$(CHAINPREFIX)/tools/gcc-4.0.2-glibc-2.3.6/arm-linux/bin/arm-linux-g++
STRIP=$(CHAINPREFIX)/tools/gcc-4.0.2-glibc-2.3.6/arm-linux/bin/arm-linux-strip

CFLAGS=-I$(CHAINPREFIX)/DGE/include -I$(CHAINPREFIX)/DGE/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -O3 -fomit-frame-pointer -ffast-math -funroll-loops -Wall -Wno-unknown-pragmas -Wno-format -DPLATFORM_WIZ
LFLAGS=-L$(CHAINPREFIX)/DGE/lib/target -L$(CHAINPREFIX)/lib/target -Wl,-rpath,$(CHAINPREFIX)/lib/target -s -Wall  -lSDL -lSDL_ttf -lSDL_image -lfreetype -lpng -ljpeg -lz
TARGET=../DinguxCommander
OBJS=main.o sdlutils.o resourceManager.o fileLister.o commander.o panel.o dialog.o window.o fileutils.o viewer.o keyboard.o

all: $(TARGET)

$(TARGET): $(OBJS)
	$(CC) -o $(TARGET)  $(OBJS) $(LFLAGS)
	$(STRIP) $(TARGET)

main.o: main.cpp def.h resourceManager.h commander.h sdlutils.h
	$(CC) $(CFLAGS) -c main.cpp

sdlutils.o: sdlutils.h sdlutils.cpp def.h window.h resourceManager.h
	$(CC) $(CFLAGS) -c sdlutils.cpp

resourceManager.o: resourceManager.h resourceManager.cpp def.h sdlutils.h def.h
	$(CC) $(CFLAGS) -c resourceManager.cpp

fileLister.o: fileLister.h fileLister.cpp
	$(CC) $(CFLAGS) -c fileLister.cpp

commander.o: commander.h commander.cpp panel.h resourceManager.h sdlutils.h def.h window.h dialog.h fileutils.h viewer.h keyboard.h
	$(CC) $(CFLAGS) -c commander.cpp

panel.o: panel.h panel.cpp fileLister.h def.h resourceManager.h sdlutils.h fileutils.h
	$(CC) $(CFLAGS) -c panel.cpp

dialog.o: dialog.h dialog.cpp sdlutils.h resourceManager.h def.h window.h
	$(CC) $(CFLAGS) -c dialog.cpp

window.o: window.h window.cpp def.h
	$(CC) $(CFLAGS) -c window.cpp

fileutils.o: fileutils.h fileutils.cpp def.h sdlutils.h
	$(CC) $(CFLAGS) -c fileutils.cpp

viewer.o: viewer.h viewer.cpp window.h def.h resourceManager.h sdlutils.h
	$(CC) $(CFLAGS) -c viewer.cpp

keyboard.o: keyboard.h keyboard.cpp window.h def.h resourceManager.h sdlutils.h
	$(CC) $(CFLAGS) -c keyboard.cpp

clean:
	rm -f $(TARGET) $(OBJS)
