# The bB OS X cross compiling makefile. This is meant to be run from Linux
#
# See COMPILE.txt for details on how to setup the supporting environment
#

export PATH := /usr/i686-apple-darwin10/bin:$(PATH)
SHELL=/bin/sh
RM=rm
CFLAGS=-arch i386 -m64 -O0
CC=i686-apple-darwin10-gcc
LEX=lex
LEXFLAGS=-t
ARCH=Darwin.x64

all:  2600basic.${ARCH} preprocess.${ARCH} postprocess.${ARCH} bbfilter.${ARCH} optimize.${ARCH}

2600basic.${ARCH}: 2600bas.c statements.c keywords.c statements.h keywords.h
	${CC} ${CFLAGS} -o 2600basic.${ARCH} 2600bas.c statements.c keywords.c

postprocess.${ARCH}: postprocess.c
	${CC} ${CFLAGS} -o postprocess.${ARCH} postprocess.c

bbfilter.${ARCH}: bbfilter.c
	${CC} ${CFLAGS} -o bbfilter.${ARCH} bbfilter.c

preprocess.${ARCH}: preprocess.lex
	${LEX} ${LEXFLAGS}<preprocess.lex>lex.yy.c
	${CC} ${CFLAGS} -o preprocess.${ARCH} lex.yy.c
	${RM} -f lex.yy.c

optimize.${ARCH}: optimize.lex
	${LEX} ${LEXFLAGS} -i<optimize.lex>lex.yy.c
	${CC} ${CFLAGS} -o optimize.${ARCH} lex.yy.c
	${RM} -f lex.yy.c

install:   all

clean:
	${RM} -f a.out core 2600basic.${ARCH} preprocess.${ARCH} postprocess.${ARCH} bbfilter.${ARCH} optimize.${ARCH}

love:
	@echo "not war"
