forked from jonathan-beard/simple_wc_example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (36 loc) · 989 Bytes
/
Makefile
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
CC ?= clang
CXX ?= clang++
EXE = my_wc
CDEBUG = -g -Wall
CXXDEBUG = -g -Wall
CSTD = -std=c99
CXXSTD = -std=c++11
CFLAGS = -Wno-deprecated-register -O0 $(CDEBUG) $(CSTD)
CXXFLAGS = -Wno-deprecated-register -O0 $(CXXDEBUG) $(CXXSTD)
CPPOBJ = main mc_driver
SOBJ = parser lexer
FILES = $(addsuffix .cpp, $(CPPOBJ))
OBJS = $(addsuffix .o, $(CPPOBJ))
CLEANLIST = $(addsuffix .o, $(OBJ)) $(OBJS) \
mc_parser.tab.cc mc_parser.tab.hh \
location.hh position.hh \
stack.hh mc_parser.output parser.o \
lexer.o mc_lexer.yy.cc $(EXE)\
.PHONY: all
all: wc
wc: $(FILES)
$(MAKE) $(SOBJ)
$(MAKE) $(OBJS)
$(CXX) $(CXXFLAGS) -o $(EXE) $(OBJS) parser.o lexer.o $(LIBS)
parser: mc_parser.yy
bison -d -v mc_parser.yy
$(CXX) $(CXXFLAGS) -c -o parser.o mc_parser.tab.cc
lexer: mc_lexer.l
flex --outfile=mc_lexer.yy.cc $<
$(CXX) $(CXXFLAGS) -c mc_lexer.yy.cc -o lexer.o
.PHONY: test
test:
cd test && ./test0.pl
.PHONY: clean
clean:
rm -rf $(CLEANLIST)