## Makefile for Fortune DA

APPNAME = "Fortune DA++"
APPID   = "FtDA"
TARGET  = FortuneDAPP
DBTYPE  = "DAcc"
HEADER  = FortuneDAPP_Rsc.h

OBJS		= FortuneDAPP.o \
		MainForm.o  \
		Framework/DraggableModalForm.o \
		Framework/ModalForm.o
RESOURCES	= rsc/FortuneDA.xrd
LIBS		=

CC			= m68k-palmos-gcc
CFLAGS		= -Wall -g -O2 -I.. -IFramework
CSFLAGS		= $(CFLAGS) -S
TARGETFLAGS	= -DL_double -DNO_GLOBALS

PILRC		= pilrc -I ..
OBJRES		= m68k-palmos-obj-res

BUILDPRC	= build-prc
BUILDPRCFLG	= --no-check-resources

.SUFFIXES : .o .c .cxx .cpp

all: $(TARGET).prc

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

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

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

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

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

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

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

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

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

$(TARGET).o: $(HEADER)


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

depend:
	makedepend -Y -I. *.c

