## SI 413 Fall 2011 ## Makefile for Lab 4 # Default target: makes both programs all: pat pat2 # Dependencies pat pat2: pat.yy.o pat.o pat2.o pat.yy.o: pat.h # Rules to generate the final compiled parser programs pat pat2: %: %.o $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ # Generic rule for compiling C++ programs from source # (Actually, make also defines this by default.) %.o: %.cpp $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< # Generic rule for running C++-style flex code generation # For instance, this will make 'pat.yy.cpp' from 'pat.lpp'. %.yy.cpp: %.lpp flex -o $@ $< .PHONY: clean all clean: rm -f *.o *.yy.cpp pat pat2