# Uncomment the following line to disable sound, if you don't have the
# SDL_sound library installed for example
#CFLAGS = -DNO_SOUND
#DBG = -g
CC = arm-open2x-linux-gcc
LD = arm-open2x-linux-ld
CFLAGS += -O2 -Wall `../sdl_purkka/sdl-config --cflags` $(DBG) \
-I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/SDL -ffast-math -funsigned-char \
-fno-strict-aliasing
LDFLAGS = -static -L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib \
-lSDL_sound -lmikmod -lsmpeg \
`../sdl_purkka/sdl-config --static-libs` -lstdc++ -lm

all: timeless.gpe gensprites

timeless.gpe: timeless.o data.o sprites.o sound.o song.o scaler.o
	$(CC) -o $@ timeless.o data.o sprites.o sound.o song.o scaler.o  $(LDFLAGS)
	arm-open2x-linux-strip timeless.gpe

timeless.o:	timeless.c timeless.h scaler.h

data.o: data.c timeless.h

sprites.o: sprites.c timeless.h

sound.o: sound.c timeless.h

song.o: song.c timeless.h

scaler.o: scaler.c scaler.h

clean:
	rm -f *.o timeless.gpe

test:	all
	./timeless

gensprites: gensprites.c

nsprites.c: gensprites
	gensprites > nsprites.c
	echo Actually you\'d want to rename nsprites.c to sprites.c


WORK = /ram
VER = 1.0.1
DDIR = SDL_timeless-$(VER)

package:  clean
	rm -rf $(WORK)/$(DDIR)
	mkdir $(WORK)/$(DDIR)
	cp *.c *.h Makefile* README $(WORK)/$(DDIR)
	cd $(WORK) && tar czf $(DDIR).tgz $(DDIR)
