CC = m68k-palmos-gcc
DEBUGCFLAGS= -g -DDEBUG_BUILD
RELEASECFLAGS= -O2
# change following from DEBUGCFLAGS to RELEASECFLAGS for a no-debug build
CFLAGS = -palmos4.0 $(DEBUGCFLAGS)
#change the following line to change the name of the built project
# make sure you also change the name of the .def file to match
APP=pbj

OBJS=main.o bj.o hint.o menu.o utils.o scroll.o random.o

$(APP).prc: $(APP) bin.stamp $(APP).def
	build-prc $(APP).def $(APP) -o $(APP).prc bin/*.bin

$(APP): $(OBJS)
	$(CC) $(CFLAGS) -o $@ $(OBJS)

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

$(OBJS): resources.h utils.h

main.o: bj.h scroll.h instructions.h

bj.o: bj.h scroll.h msgs.h

hint.o: bj.h resources.h

utils.o: bj.h

menu.o: bj.h instructions.h scroll.h

bin.stamp: resources.rcp resources.h pbj.pbitm
	rm -f *.bin
	pilrc -q -I . resources.rcp
	touch bin.stamp
	mv *.bin bin

clean:
	rm -f $(OBJS) $(APP) $(APP).prc bin/* bin.stamp
