# $Id: Makefile,v 1.3 2001/11/30 23:25:47 cactus Exp $
#
# You are free to use, modify, and redistribute this file any way you
# wish, including incorporation into closed source products, as long
# as you give credit to its copyright holder (see below).
#
# Copyright (c) 2001  RDI Gerg <cactus@cactus.rulez.org>

CC		= m68k-palmos-coff-gcc
OBJ_RES		= m68k-palmos-coff-obj-res
PILRC		= pilrc
G2RCP		= guikachu2rcp
BUILD_PRC	= build-prc

CFLAGS		= -Wall -g -pipe

APP_TITLE	= "SampleApp"
APP_NAME	= "SampleApp"

SRCS		= sample-app.c menu.c main-form.c results-form.c
GUIKACHU	= sample-app.guikachu
OBJS		= $(patsubst %.c, %.o, $(SRCS))
RCP		= $(patsubst %.guikachu, %.rcp, $(GUIKACHU))
RCP_H		= $(patsubst %.guikachu, %.rcp.h, $(GUIKACHU))
PRC		= $(patsubst %.guikachu, %.prc, $(GUIKACHU))
EXEC		= sample-app

.PHONY: all clean dep

all: dep $(PRC)

%.rcp: %.guikachu
	$(G2RCP) $<

$(RCP_H): $(RCP)
	$(PILRC) -H $<.h $<

$(PRC) : $(EXEC) $(RCP_H)
	$(BUILD_PRC) $@ $(APP_TITLE) $(APP_NAME) *.grc *.bin

$(EXEC): $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $^
	$(OBJ_RES) $@

dep: .depend

.depend: $(SRCS) $(RCP_H)
	$(CPP) $(CPPFLAGS) -MM $(SRCS) >$@

clean:
	rm -f $(OBJS) $(EXEC)
	rm -f *.prc
	rm -f *.grc *.bin $(RCP_H) $(RCP)

ifeq (.depend,$(wildcard .depend))
include .depend
endif
