## Makefile for Palm Time Table
## Copyright (C) 2000 Per Jonsson
## Author: Per Jonsson <poj@users.sourceforge.net>
##
## $Id: Makefile,v 1.4 2000/05/26 18:58:06 poj Exp $

TARGET = palmsched
APPNAME = "Palm Time Table"
APPID = "PoJt"

OBJS = $(TARGET).o teacherselect.o
LIBS = -lpojpalm

CC = m68k-palmos-coff-gcc

CFLAGS = -Wall -g -O2 -I./palm-lib -L./palm-lib 

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

SUBDIRS = palm-lib
SUBFILES =

all: all-recursive $(TARGET).prc

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

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

$(TARGET).prc: code0000.$(TARGET).grc code0001.$(TARGET).grc data0000.$(TARGET).grc pref0000.$(TARGET).grc rloc0000.$(TARGET).grc bin.res
	$(BUILDPRC) $(TARGET).prc $(APPNAME) $(APPID) code0001.$(TARGET).grc code0000.$(TARGET).grc data0000.$(TARGET).grc *.bin pref0000.$(TARGET).grc rloc0000.$(TARGET).grc

code0000.$(TARGET).grc: $(TARGET)
	$(OBJRES) $(TARGET)

code0001.$(TARGET).grc: code0000.$(TARGET).grc

data0000.$(TARGET).grc: code0000.$(TARGET).grc

pref0000.$(TARGET).grc: code0000.$(TARGET).grc

rloc0000.$(TARGET).grc: code0000.$(TARGET).grc

bin.res: $(TARGET).rcp $(TARGET).pbm
	$(PILRC) $(TARGET).rcp .
	touch bin.res

$(TARGET): $(OBJS) 
	$(CC) $(CFLAGS) $(OBJS) $(LIBS) -o $(TARGET)
	! $(NM) -u $(TARGET) | grep .

send: all
	$(PILOTXFER) -i $(TARGET).prc

depend:
	makedepend -Y -I. *.c

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

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

vc: veryclean


all-recursive clean-recursive:
	for subdir in $(SUBDIRS); do target=`echo $@ | sed s/-recursive//`; echo making $$target in $$subdir; (cd $$subdir && $(MAKE) $$target) || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; done && test -z "$$fail"

