-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (56 loc) · 2.11 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# $Id: Makefile,v 1.1 2016/02/19 19:29:48 david Exp $
#---------------------------------------------------------------
# CONFIGURE THESE VARIABLES IF NEEDED
#---------------------------------------------------------------
ROOT = ${HOME}/compiladores/root
CDK_INC_DIR = $(ROOT)/usr/include
CDK_LIB_DIR = $(ROOT)/usr/lib
L_NAME=zu_scanner
Y_NAME=zu_parser
#---------------------------------------------------------------
# PROBABLY, NO NEED TO CHANGE ANYTHING BEYOND THIS POINT
#---------------------------------------------------------------
LFLAGS =
YFLAGS = -dtvP
CXXFLAGS = -std=c++11 -DYYDEBUG=1 -Wall -ggdb -Itargets -I. -I$(CDK_INC_DIR) -I$(CDK_INC_DIR)/cdk
#CXXFLAGS = -std=c++11 -DYYDEBUG=1 -Wall -O3 -ggdb -Itargets -I. -I$(CDK_INC_DIR) -I$(CDK_INC_DIR)/cdk
LDFLAGS = -L$(CDK_LIB_DIR) -lcdk
#LDFLAGS = -L$(CDK_LIB_DIR) -lcdk -lLLVMCore -lLLVMSupport
COMPILER = zu
LEX = flex
YACC = byacc
SRC_CPP = $(shell find ast -name \*.cpp) $(wildcard targets/*.cpp) $(wildcard ./*.cpp)
OFILES = $(SRC_CPP:%.cpp=%.o)
#---------------------------------------------------------------
# DO NOT CHANGE AFTER THIS LINE
#---------------------------------------------------------------
all: ast/all.h $(COMPILER)
%.tab.o:: %.tab.c
$(CXX) $(CXXFLAGS) -DYYDEBUG -c $< -o $@
%.o:: %.c
$(CXX) $(CXXFLAGS) -c $< -o $@
%.o:: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
%.tab.c:: %.y
$(YACC) -dtv -b $* $<
%.tab.h:: %.y
$(YACC) -dtv -b $* $<
$(L_NAME).cpp: $(L_NAME).l
$(LEX) $(LFLAGS) $<
$(Y_NAME).tab.c: $(Y_NAME).y
$(Y_NAME).tab.h: $(Y_NAME).y
# this is needed to force byacc to run
$(L_NAME).o: $(L_NAME).cpp $(Y_NAME).tab.h
.PHONY: ./mknodedecls.pl
ast/all.h: ./mknodedecls.pl
./mknodedecls.pl > ast/all.h
$(COMPILER): $(L_NAME).o $(Y_NAME).tab.o $(OFILES)
$(CXX) -o $@ $^ $(LDFLAGS)
clean:
$(RM) *.tab.[ch] *.o $(OFILES) $(L_NAME).cpp $(Y_NAME).output $(COMPILER)
depend: ast/all.h
$(CXX) $(CXXFLAGS) -MM $(SRC_CPP) > .makedeps
-include .makedeps
#---------------------------------------------------------------
# THE END
#---------------------------------------------------------------