# SI 413 Lab 03
# Makefile for simple calculator

# This is the executable that will run the calculator.
# Since it is the first rule, it is also what will get made if
# we call "make" with no arguments.
mycalc: calc.tab.o lex.yy.o
	g++ -o mycalc lex.yy.o calc.tab.o

# Bison generates a C++ source file and a C++ header file.
calc.tab.cpp calc.tab.hpp: calc.ypp
	bison -d calc.ypp

# Flex generates just a C++ source file.
lex.yy.cpp: calc.lpp
	flex -o lex.yy.cpp calc.lpp

# The lex file includes the header from Bison.
lex.yy.o: lex.yy.cpp calc.tab.hpp
	g++ -c lex.yy.cpp

calc.tab.o: calc.tab.cpp
	g++ -c calc.tab.cpp

# Uncomment the following line to have make automatically delete
# these temporary files for you.
#.INTERMEDIATE: calc.tab.o lex.yy.o lex.yy.cpp calc.tab.cpp calc.tab.hpp

.PHONY: clean
clean:
	-rm -f calc.tab.o lex.yy.o lex.yy.cpp calc.tab.cpp calc.tab.hpp mycalc