1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## SI 413 Fall 2012
## Makefile for Lab 5
 
# Default target: makes both programs
all: pat1 pat2
 
# Dependencies
pat1 pat2: pat.yy.o
pat1.o pat2.o pat.yy.o: pat.hpp
 
# Rules to generate the final compiled parser programs
pat1 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 pat1 pat2