CC=cc CFLAGS=-O3 EXECUTABLE_NAME=soforth PREFIXDIR=/home/kfogel BINDIR=${PREFIXDIR}/bin LIBDIR=${PREFIXDIR}/lib/soforth # This is where soforth expects to find its standard forth library. # The library is not optional; it contains essential parts of the # system, like `if', `else', `then', and `recurse'. # If no STD_LIB is defined here, forth.h will define it to simply # "soforth.fth", and soforth will look for it in the current directory # at run time. STD_LIB=${LIBDIR}/soforth.fth OBJS=arith.o logic.o print.o stack.o memory.o control.o system.o \ compile.o dict.o strings.o prims.o init_prims.o forth.o SOURCES=arith.c logic.c print.c stack.c memory.c control.c system.c \ compile.c dict.c strings.c prims.c forth.c all: soforth soforth: ${OBJS} ${CC} ${OBJS} -o ${EXECUTABLE_NAME} ${CFLAGS} init_prims.c: ${SOURCES} @echo Gawking init_prims.c... cat ${SOURCES} | gawk -f prims.awk > init_prims.c @echo Gawking init_prims.c... done. # forth.o is special because we must define STD_LIB. forth.o: forth.c forth.h ${CC} -c forth.c -o forth.o ${CFLAGS} -DSTD_LIB=\"${STD_LIB}\" arith.o: arith.c forth.h logic.o: logic.c forth.h print.o: print.c forth.h stack.o: stack.c forth.h memory.o: memory.c forth.h control.o: control.c forth.h system.o: system.c forth.h compile.o: compile.c forth.h dict.o: dict.c forth.h strings.o: strings.c forth.h init_prims.o: init_prims.c forth.h prims.o: prims.c forth.h install: all if [ ! \( -d ${PREFIXDIR} \) ]; then mkdir ${PREFIXDIR}; fi if [ ! \( -d ${BINDIR} \) ]; then mkdir ${BINDIR}; fi cp ${EXECUTABLE_NAME} ${BINDIR} chmod a+x ${BINDIR}/${EXECUTABLE_NAME} if [ ! \( -d ${LIBDIR} \) ]; then mkdir ${LIBDIR}; fi cp soforth.fth ${LIBDIR} chmod u+rw ${LIBDIR}/soforth.fth clean: rm -f soforth *.o