CFLAGS=-D_GIMP -Wall -O3
CC = gcc

OBJECTS=mathmap.o builtins.o exprtree.o parser.o scanner.o postfix.o vars.o

mathmap : $(OBJECTS)
	$(CC) -o mathmap -lglib -lgdk -lgtk -lgimp -lm $(OBJECTS)

%.o : %.c
	$(CC) $(CFLAGS) -c $<

parser.c : parser.y
	bison -d parser.y
	mv parser.tab.c parser.c
	mv parser.tab.h parser.h

scanner.c : scanner.fl
	flex scanner.fl
	mv lex.yy.c scanner.c

install : mathmap
	cp mathmap $(HOME)/.gimp/plug-ins/

clean :
	rm -f *~ *.o mathmap scanner.c parser.[ch]
