CC = m68k-palmos-gcc
CFLAGS = -Wall -palmos5 -O2 -s
LDFLAGS = -static -palmos5 -L/usr/m68k-palmos/lib -lPalmOSGlue

EXECS = garux asmloader

garux.prc: $(EXECS) image.bin graphics
	build-prc -n Garux -c ARML $(EXECS) page????.bin tAIB????.bin tAIN????.bin tFRM????.bin tSTR????.bin

asmloader: asmloader.o
	arm-palmos-gcc -nostartfiles -o asmloader asmloader.o

asmloader.o: asmloader.c garux.h
	arm-palmos-gcc $(CFLAGS) -c asmloader.c

garux: garux.o
	m68k-palmos-gcc garux.o -o garux $(LDFLAGS)

garux.o: garux.c garux.h

garux.h: image.bin
	./garux.h.sh

image.bin:
	cp Image image.bin
	./split.pl image.bin

graphics: garux.h
	pilrc garux.rcp

.PHONY: clean
clean:
	-rm -f *.prc *.o $(EXECS) garux.h *.map *~ *.bin
