## Makefile for Fortune DA

TARGET  = Fortune_DA
APPNAME = "Fortune DA"
APPID   = "FtDA"
DBTYPE  = "DAcc"
HEADER  = Defs.h

OBJS    = $(TARGET).o
LIBS    =

CC      = m68k-palmos-coff-gcc

CFLAGS      = -Wall -g -O2 -I..
CSFLAGS     = $(CFLAGS) -S
TARGETFLAGS = -DL_double -DNO_GLOBALS

PILRC     = pilrc -I ..
OBJRES    = m68k-palmos-coff-obj-res
BUILDPRC  = build-prc
PILOTXFER = pilot-xfer

ZIP       = Fortune_DA.zip

all: $(TARGET).prc

.S.o:
	$(CC) $(TARGETFLAGS) -c $<

.c.s:
	$(CC) $(CSFLAGS) $<

.cc.s:
	$(CC) $(CSFLAGS) $<

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

$(TARGET).prc: code03e8.grc bin.res
	$(BUILDPRC) -t $(DBTYPE) $(TARGET).prc $(APPNAME) $(APPID) code03e8.grc *.bin

code03e8.grc: $(TARGET)
	$(OBJRES) $(TARGET)
	mv code0001.$(TARGET).grc $@
	rm *.$(TARGET).grc

bin.res: $(TARGET).rcp $(HEADER)
	-rm -f *.bin
	$(PILRC) $(TARGET).rcp .
	touch bin.res

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) -nostartfiles $(OBJS) -o $(TARGET) $(LIBS)

install: $(TARGET).prc
	$(PILOTXFER) -i $(TARGET).prc

depend:
	makedepend -Y -I. *.c

clean:
	-rm -f *.[oa] $(TARGET) *.bin bin.res *.grc Makefile.bak

veryclean: clean
	-rm -f $(TARGET).prc pilot.ram pilot.scratch

$(TARGET).o: $(HEADER)

zip:
	zip $(ZIP) Makefile Defs.h Fortune_DA.c Fortune_DA.rcp \
	readme-j.txt readme-e.txt

uu: zip
	uuencode $(ZIP) $(ZIP) >uu
