-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
33 lines (24 loc) · 860 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
OBJ = dcc
override CFLAGS += -O3 -flto -Wall -DYYERROR_VERBOSE -std=c++11 `llvm-config --cppflags --libs all --ldflags --system-libs`
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
CXX ?= g++
LEX = flex
YACC = bison -d --report=all --warnings=all
$(OBJ) : $(OBJ).tab.o lex.yy.o main.o AST.h CodeGenVisitor.h SymbolTable.h Visitor.h
$(CXX) -o $@ $(OBJ).tab.o lex.yy.o main.o $(CFLAGS)
%.o : %.c
$(CXX) $^ -c $(CFLAGS)
%.o : %.cpp
$(CXX) $^ -c $(CFLAGS)
${OBJ}.tab.c : $(OBJ).y
$(YACC) $(OBJ).y
lex.yy.c : $(OBJ).l $(OBJ).tab.c
$(LEX) $(OBJ).l
clean :
rm -f $(OBJ) lex.yy.c ${OBJ}.tab.c ${OBJ}.tab.h ${OBJ}.tab.o lex.yy.o main.o dcc.output
all : ${OBJ}
debug : clean
$(YACC) --debug $(OBJ).y
$(LEX) $(OBJ).l
$(CXX) $(OBJ).tab.c lex.yy.c main.cpp -g -O0 -DDEBUG -std=c++11 -o $(OBJ) `llvm-config --cppflags --libs all --ldflags --system-libs`