#*****************************************************************************
#
#			      PilotForth
#
#      Copyright (C) 1997, Ivan A. Curtis.  All rights reserved.
#
#			       based on
# C-FORTH: a portable, C-coded figFORTH interpreter by Allan Pratt April 1985.
#
# This program may not be redistibuted in part or in whole without this
# Copyright Message being included at the top of each file.
#
#   This is free software, licensed under the GNU Public License V2.
#		  See the file COPYING for details.
#
#******************************************************************************
#******************************************************************************
#
# Filename:	Forth/Makefile
#
# Description:	Makefile for PilotForth
#
# Update History:   (most recent first)
#   I. Curtis  15-May-97 20:59 -- v0.1 Released.
#
#******************************************************************************

NAME = Forth

PREFIX = ${HOME}/develop/pilot/prc-tools-0.4.1
#uncomment this if you want to build a gdb debuggable version
#DEFINES = -DDEBUG
CFLAGS = -O2 -Wall $(DEFINES) -I${PREFIX}/libc.0.1.1/include/

CC = /usr/local/bin/m68k-palmos-coff-gcc
OBJS = ${NAME}.o exec.o prims.o memory.o
LIBS = -L ${PREFIX} -lgdb -lc

PILRC = ${PREFIX}/pilrc
TXT2BITM = ${PREFIX}/txt2bitm
OBJRES = /usr/local/m68k-palmos-coff/bin/obj-res
BUILDPRC = ${PREFIX}/build-prc

ICONTEXT = "${NAME}"
APPID = i4th

all::
	cd bootstrap; ${MAKE} all

all:: ${NAME}.prc

${NAME}.prc: code0000.${NAME}.bin code0001.${NAME}.bin data0000.${NAME}.bin bin.res
	$(BUILDPRC) ${NAME}.prc $(ICONTEXT) $(APPID) code0001.${NAME}.grc code0000.${NAME}.grc data0000.${NAME}.grc *.bin pref0000.${NAME}.grc

code0000.${NAME}.bin: ${NAME}
	$(OBJRES) ${NAME}

code0001.${NAME}.bin: code0000.${NAME}.bin

data0000.${NAME}.bin: code0000.${NAME}.bin

bin.res: ${NAME}.rcp ${NAME}.pbitm
	$(PILRC) ${NAME}.rcp .
	$(TXT2BITM) ${NAME}.pbitm
	touch bin.res

${NAME} :: $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o ${NAME} $(LIBS)

clean::
	cd bootstrap; ${MAKE} clean

clean::
	/bin/rm -f *~ core
	/bin/rm -f *.[oa] ${NAME} *.bin bin.res *.grc

clobber::
	cd bootstrap; ${MAKE} clobber

clobber:: clean
	/bin/rm -f Forth.prc
