#Makefile for gcc PalmPilot crosscompiler m68k-palmos-gcc package.
# Change the strings from APP to BUILDPRC to match your own
# system configuration.
# Place the file into the developping directory.
# "make clean" removes all generated files, even the ".prc".
APP             =soaring
ICONTEXT        ="SoarPilot"
APPID           =Soar
RCP             =$(APP).rcp
PRC             =$(APP).prc
SRC             =$(wildcard *.c)
#SRC             =$(APP).c
#SRC             =soaring.c soarDB.c util.c parser.c serial.c standard_form.c
GRC             =$(APP).grc
BIN             =$(APP).bin

CC              =m68k-palmos-gcc
PILRC           =pilrc
TXT2BITM        =txt2bitm
OBJRES          =m68k-palmos-obj-res
BUILDPRC        =build-prc

# uncomment this if you want to build a gdb debuggable version
# -On: n=Optimization-level (0=none), -g: needed for debugging
#CFLAGS          =-O0 -g $(DEFINES) $(INCLUDES)
#CFLAGS          =-O0 $(DEFINES) $(INCLUDES)
CFLAGS          =-O2 -palmos3.1 $(DEFINES) $(INCLUDES)

all:            $(PRC)

$(PRC):       grc.stamp bin.stamp;
	$(BUILDPRC) $(PRC) $(ICONTEXT) $(APPID) *.grc *.bin $(LINKFILES) 
	ls -l *.prc

grc.stamp:    $(APP) ;
	$(OBJRES) $(APP)
	touch $@

$(APP):       $(SRC:.c=.o) ;
	$(CC) $(CFLAGS) $^ -o $@

bin.stamp:    $(RCP) ;
	$(PILRC) $^ $(BINDIR)
	touch $@

%.o:  %.c ;
	$(CC) $(CFLAGS) -c $< -o $@
	#               touch $<
	# enable this line if you want to compile EVERY time.

depend dep: ;
	$(CC) -M $(SRC) > .dependencies


clean:
	rm -rf *.o $(APP) *.bin *.grc *.prc *.stamp
