-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (31 loc) · 788 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
EXEC = semantic.out
BUILDDIR = Build
TESTDIR = Test
FLEX = flex
BISON = bison
CXX = clang++
CXXFLAGS = -std=c++17 -g
OBJECTS = $(BUILDDIR)/grammar.tab.o $(BUILDDIR)/lex.yy.o $(BUILDDIR)/ast.o $(BUILDDIR)/traversal.o $(BUILDDIR)/sym.o
$(EXEC): $(OBJECTS)
$(CXX) $(CXXFLAGS) -o $(EXEC) $(OBJECTS)
grammar.tab.c grammar.tab.h : grammar.y
$(BISON) -d grammar.y
lex.yy.c : lexer.l grammar.tab.h
$(FLEX) lexer.l
$(BUILDDIR)/%.o: %.cpp %.h
@mkdir -p $(BUILDDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: %.c %.h
@mkdir -p $(BUILDDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: %.c
@mkdir -p $(BUILDDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
test: $(EXEC)
cd $(TESTDIR) && ./test.sh
clean:
rm -f *.yy.c
rm -f *.tab.c
rm -f *.tab.h
rm -f $(BUILDDIR)/*.o
rm -f $(EXEC)