#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 calc.o eval.o util.o
	gcc -o genius genius.o parse.yy.o parse.tab.o calc.o eval.o \
	util.o $(LIBS)

genius.o: genius.c calc.h genius.h util.h
	gcc $(CFLAGS) -c genius.c

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

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

util.o: util.c util.h
	gcc $(CFLAGS) -c util.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)
