CCC = g++
CFLAGS = -c -g -Wall -Wno-sign-compare
CCFLAGS = $(CFLAGS)
LDFLAGS = -g

common_objects = main.o tokens.o
flex_objects = flex_scanner.o 
hand_objects = hand_scanner.o 


both: flex_scanner hand_scanner

flex_scanner: $(flex_objects) $(common_objects)
	$(CCC) $(LDFLAGS) $(flex_objects) $(common_objects) -o flex_scanner

hand_scanner: $(hand_objects) $(common_objects)
	$(CCC) $(LDFLAGS) $(hand_objects) $(common_objects) -o hand_scanner

flex_scanner.o: flex_scanner.l
	flex -it flex_scanner.l > flex_scanner.cpp
	$(CCC) $(CCFLAGS) flex_scanner.cpp

hand_scanner.o: hand_scanner.cpp
	$(CCC) $(CCFLAGS) hand_scanner.cpp

clean:
	/bin/rm -f hand_scanner flex_scanner $(hand_objects) $(flex_objects) \
		$(common_objects) flex_scanner.cpp

test: both
	flex_scanner < test3 > flex_test3.output
	hand_scanner < test3 > hand_test3.output

submit:
	cat flex_scanner.l hand_scanner.cpp > hw1
