#--------------------------------------------------------------------------------
#
# Makefile for the optimizer generator OPTGEN
# Programmer: Leonidas Fegaras
# Date: 2/27/97
#
#--------------------------------------------------------------------------------

# The GC directory (the garbage collector)
GCDIR = /export/home/fegaras/gc

# Note: remove the following line
#   %option noyywrap
# from optgen.lex if flex complains

GCC = g++
CXXFLAGS = -g
YACC = bison
LEX = flex
INCLUDE = basic.h


optgen:	external.h optgen.o basic.o
	$(GCC) optgen.o basic.o $(GCDIR)/gc.a -o optgen

external.h:
	    echo "#include"'"'$(GCDIR)"/gc_cpp.h"'"' > external.h

basic.o: basic.h basic.cc
	 $(GCC) $(CXXFLAGS) -c basic.cc

optgen.o: optgen.cc optgen.yy.c $(INCLUDE)
	  $(GCC) $(CXXFLAGS) -c optgen.cc

optgen.cc: optgen.y
	   $(YACC) optgen.y
	   mv optgen.tab.c optgen.cc

optgen.yy.c: optgen.lex
	     $(LEX) optgen.lex
	     mv lex.yy.c optgen.yy.c

clean: 
	/bin/rm -f *.o *~ optgen.yy.c optgen.cc external.h core
