#genius makefile
#
# You will need GTK+ and GMP for this to compile
# Also your system has to have flex and bison ... for other versions of
# lex and yacc the Makefiles and maybe sourcefiles might have to be
# modified

#set this according to your system (this should work for most)
LIBS=-L/usr/X11R6/lib -lglib -lgdk -lgtk -lX11 -lXext -lm -lfl -lgmp

#CFLAGS=-O2 -fomit-frame-pointer -Wall -I/usr/X11R6/include
CFLAGS=-g -Wall -I/usr/X11R6/include

#where to install
DESTDIR=/usr/local/bin
MANDESTDIR=/usr/local/man/man1

###############################################################################
#you don't have to edit anything below
all: genius

genius: genius.o parse.yy.o parse.tab.o parser.o eval.o
	gcc -o genius genius.o parse.yy.o parse.tab.o parser.o eval.o $(LIBS)

genius.o: genius.c
	gcc $(CFLAGS) -c genius.c

parser.o: parser.c eval.h parse.y
	gcc $(CFLAGS) -c parser.c

eval.o: eval.c eval.h
	gcc $(CFLAGS) -c eval.c

parse.yy.o: parse.l eval.h parse.y parse.tab.o
	flex -oparse.yy.c parse.l
	gcc ${CFLAGS} -c parse.yy.c

parse.tab.o: parse.y eval.h
	bison -d parse.y
	gcc ${CFALGS} -c parse.tab.c

clean:
	rm -f *.o genius *.tab.[ch] *.yy.c tst

install: genius
	cp -f genius $(DESTDIR)
