#
# Makefile for kForth-fast
#
# Copyright (c) 1998--2005 Creative Consulting for Research and Education
# Provided under the terms of the GNU General Public License
#
# Last Revised: 2005-09-28
#
# Possible invocations:
#
#	make		creates dynamically linked release executable
#	make clean	remove all object files belonging to this project
#	make debug	create statically linked debug executable
#	make archive	create a compressed tar file
#
# Notes:
#
#   1. If a debug version is being built, always invoke "make clean" 
#      before "make debug".
#
#
# Default debug option creates a release version of the executable.
# Invoke "make debug" if you want to create an executable
# that contains debugging information for the GNU debugger (gdb).

VERSION = 1.3.1
BUILD_DATE=`date +%F`
DEBUG = 

# location of gcc and g++
GCCDIR = /usr/bin

CPP = ${GCCDIR}/g++
CC  = ${GCCDIR}/gcc
CPPFLAGS = -c -m32
CCFLAGS = -c -m32
OBJS = kforth-fast.o ForthVM-fast.o ForthCompiler-fast.o vm-fast.o vmc-fast.o
LIBS = -lreadline -lncurses

kforth-fast: ${OBJS} 
	${CPP} -m32 -o kforth-fast ${DEBUG} ${OBJS} ${LIBS}

clean:
	- rm -f ${OBJS} kforth-fast

debug:
	make kforth-fast "DEBUG = -g"

kforth-fast.o: kforth-fast.cpp ForthVM.h ForthCompiler.h
	${CPP} ${CPPFLAGS} ${DEBUG}  -DVERSION=\"${VERSION}\" \
	-DBUILD_DATE=\"${BUILD_DATE}\" kforth-fast.cpp

ForthVM-fast.o: ForthVM-fast.cpp ForthVM.h fbc.h ForthCompiler.h
	${CPP} ${CPPFLAGS} ${DEBUG} ForthVM-fast.cpp

ForthCompiler-fast.o: ForthCompiler-fast.cpp ForthCompiler.h fbc.h
	${CPP} ${CPPFLAGS} ${DEBUG} ForthCompiler-fast.cpp

vm-fast.o: vm-fast.s
	as --32 -o vm-fast.o vm-fast.s

vmc-fast.o: vmc-fast.c
	${CC} ${CCFLAGS} ${DEBUG} vmc-fast.c

# end of makefile

