-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·201 lines (147 loc) · 5.56 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
STRUCTURES_PATH = src/structures/
DB_PATH = src/db/
ALG_PATH = src/algorithm/
OPERATION_PATH = src/structures/operations/
STRATEGIES_PATH = src/structures/strategies/
DATA_PATH = data/
LEX_FILE = sql.l
YACC_FILE = sql.y
SRC_INDEX = $(STRUCTURES_PATH)index.cpp
SRC_COLUMN = $(STRUCTURES_PATH)column.cpp
SRC_TABLE = $(STRUCTURES_PATH)table.cpp
SRC_DATABASE = $(STRUCTURES_PATH)database.cpp
SRC_RESULT = $(STRUCTURES_PATH)result.cpp
SRC_CACHE = $(STRUCTURES_PATH)cache.cpp
SRC_FOREIGN_KEY = $(STRUCTURES_PATH)foreign-key.cpp
SRC_PROGRAM = $(DB_PATH)program.cpp
SRC_CONFIG = $(DB_PATH)config.cpp
SRC_PROXY = $(DB_PATH)proxy.cpp
SRC_NETWORK = $(ALG_PATH)network.cpp
SRC_TOPOSORT = $(ALG_PATH)toposort.cpp
SRC_INDEXCON = $(OPERATION_PATH)indexcon.cpp
SRC_INDEXSCAN = $(OPERATION_PATH)indexscan.cpp
SRC_OPERATION = $(OPERATION_PATH)operation.cpp
SRC_SEQSCAN = $(OPERATION_PATH)seqscan.cpp
SRC_HASH_JOIN = $(OPERATION_PATH)hash-join.cpp
SRC_MERGE_JOIN = $(OPERATION_PATH)merge-join.cpp
SRC_NESTED_JOIN = $(OPERATION_PATH)nested-join.cpp
SRC_LB = $(STRATEGIES_PATH)load-balance.cpp
SRC_RR = $(STRATEGIES_PATH)round-robin.cpp
SRC_LW = $(STRATEGIES_PATH)least-work.cpp
SRC_SMART = $(STRATEGIES_PATH)smart.cpp
SRC_FILTER = $(OPERATION_PATH)filter.cpp
SRC_SORT = $(OPERATION_PATH)sort.cpp
SRC_GROUP = $(OPERATION_PATH)group.cpp
SRC_OR_UNION = $(OPERATION_PATH)or-union.cpp
SRC_MAIN = src/main.cpp
CXX = g++
CXXFLAGS = -g -std=c++11 -lcpprest -lpthread
LEX_YACC_FLAGS = -ll -lfl -ly
POSTGE_FLAGS = -lpqxx -lpq
LEX = lex
LEXFLAGS =
YACC = yacc
YACCFLAGS = -d
OBJ_INDEX = ${SRC_INDEX:.cpp=.o}
OBJ_COLUMN = ${SRC_COLUMN:.cpp=.o}
OBJ_TABLE = ${SRC_TABLE:.cpp=.o}
OBJ_DATABASE = ${SRC_DATABASE:.cpp=.o}
OBJ_PROXY = ${SRC_PROXY:.cpp=.o}
OBJ_RESULT = ${SRC_RESULT:.cpp=.o}
OBJ_CACHE = ${SRC_CACHE:.cpp=.o}
OBJ_FOREIGN_KEY = ${SRC_FOREIGN_KEY:.cpp=.o}
OBJ_NETWORK = ${SRC_NETWORK:.cpp=.o}
OBJ_TOPOSORT = ${SRC_TOPOSORT:.cpp=.o}
OBJ_INDEXCON = ${SRC_INDEXCON:.cpp=.o}
OBJ_INDEXSCAN = ${SRC_INDEXSCAN:.cpp=.o}
OBJ_OPERATION = ${SRC_OPERATION:.cpp=.o}
OBJ_SEQSCAN = ${SRC_SEQSCAN:.cpp=.o}
OBJ_LB = ${SRC_LB:.cpp=.o}
OBJ_RR = ${SRC_RR:.cpp=.o}
OBJ_LW = ${SRC_LW:.cpp=.o}
OBJ_SMART = ${SRC_SMART:.cpp=.o}
OBJ_HASH_JOIN = ${SRC_HASH_JOIN:.cpp=.o}
OBJ_MERGE_JOIN = ${SRC_MERGE_JOIN:.cpp=.o}
OBJ_NESTED_JOIN = ${SRC_NESTED_JOIN:.cpp=.o}
OBJ_FILTER = ${SRC_FILTER:.cpp=.o}
OBJ_SORT = ${SRC_SORT:.cpp=.o}
OBJ_GROUP = ${SRC_GROUP:.cpp=.o}
OBJ_OR_UNION = ${SRC_OR_UNION:.cpp=.o}
OBJ_PROGRAM = ${SRC_PROGRAM:.cpp=.o}
OBJ_CONFIG = ${SRC_CONFIG:.cpp=.o}
MAIN=main
main: lex_yacc_part cache balance network toposort operations index column table result database foreign-key program config
$(CXX) $(CXXFLAGS) -o $@ src/main.cpp $(OBJ_LB) $(OBJ_RR) $(OBJ_LW) $(OBJ_SMART) $(OBJ_TOPOSORT) $(OBJ_NESTED_JOIN) $(OBJ_FILTER) $(OBJ_SORT) $(OBJ_GROUP) $(OBJ_OR_UNION) $(OBJ_MERGE_JOIN) $(OBJ_HASH_JOIN) $(OBJ_FOREIGN_KEY) $(OBJ_CACHE) $(OBJ_NETWORK) $(OBJ_SEQSCAN) $(OBJ_INDEXCON) $(OBJ_INDEXSCAN) $(OBJ_OPERATION) $(OBJ_PROXY) $(OBJ_TOKEN) $(OBJ_CONFIG) $(OBJ_PROGRAM) $(OBJ_RESULT) $(OBJ_DATABASE) $(OBJ_TABLE) $(OBJ_COLUMN) $(OBJ_INDEX) $(LEX_YACC_FLAGS) $(POSTGE_FLAGS)
operations: indexcon indexscan seqscan hash-join merge-join nested-join filter sort group or-union
$(CXX) $(CXXFLAGS) -c $(SRC_OPERATION) -o $(OBJ_OPERATION)
balance: rr lw smart
$(CXX) $(CXXFLAGS) -c $(SRC_LB) -o $(OBJ_LB)
rr:
$(CXX) $(CXXFLAGS) -c $(SRC_RR) -o $(OBJ_RR)
lw:
$(CXX) $(CXXFLAGS) -c $(SRC_LW) -o $(OBJ_LW)
smart:
$(CXX) $(CXXFLAGS) -c $(SRC_SMART) -o $(OBJ_SMART)
cache:
$(CXX) $(CXXFLAGS) -c $(SRC_CACHE) -o $(OBJ_CACHE)
foreign-key:
$(CXX) $(CXXFLAGS) -c $(SRC_FOREIGN_KEY) -o $(OBJ_FOREIGN_KEY)
indexcon:
$(CXX) $(CXXFLAGS) -c $(SRC_INDEXCON) -o $(OBJ_INDEXCON)
indexscan:
$(CXX) $(CXXFLAGS) -c $(SRC_INDEXSCAN) -o $(OBJ_INDEXSCAN)
seqscan: $(SRC_SEQSCAN)
$(CXX) $(CXXFLAGS) -c $(SRC_SEQSCAN) -o $(OBJ_SEQSCAN)
hash-join: $(SRC_HASH_JOIN)
$(CXX) $(CXXFLAGS) -c $(SRC_HASH_JOIN) -o $(OBJ_HASH_JOIN)
merge-join: $(SRC_MERGE_JOIN)
$(CXX) $(CXXFLAGS) -c $(SRC_MERGE_JOIN) -o $(OBJ_MERGE_JOIN)
nested-join: $(SRC_NESTED_JOIN)
$(CXX) $(CXXFLAGS) -c $(SRC_NESTED_JOIN) -o $(OBJ_NESTED_JOIN)
filter: $(SRC_FILTER)
$(CXX) $(CXXFLAGS) -c $(SRC_FILTER) -o $(OBJ_FILTER)
sort: $(SRC_SORT)
$(CXX) $(CXXFLAGS) -c $(SRC_SORT) -o $(OBJ_SORT)
group: $(SRC_GROUP)
$(CXX) $(CXXFLAGS) -c $(SRC_GROUP) -o $(OBJ_GROUP)
or-union: $(SRC_OR_UNION)
$(CXX) $(CXXFLAGS) -c $(SRC_OR_UNION) -o $(OBJ_OR_UNION)
network:
$(CXX) $(CXXFLAGS) -c $(SRC_NETWORK) -o $(OBJ_NETWORK)
toposort:
$(CXX) $(CXXFLAGS) -c $(SRC_TOPOSORT) -o $(OBJ_TOPOSORT)
index:
$(CXX) $(CXXFLAGS) -c $(SRC_INDEX) -o $(OBJ_INDEX)
column:
$(CXX) $(CXXFLAGS) -c $(SRC_COLUMN) -o $(OBJ_COLUMN)
table:
$(CXX) $(CXXFLAGS) -c $(SRC_TABLE) -o $(OBJ_TABLE)
database:
$(CXX) $(CXXFLAGS) -c $(SRC_DATABASE) -o $(OBJ_DATABASE)
result:
$(CXX) $(CXXFLAGS) -c $(SRC_RESULT) -o $(OBJ_RESULT)
program:
$(CXX) $(CXXFLAGS) -c $(SRC_PROGRAM) -o $(OBJ_PROGRAM)
config:
$(CXX) $(CXXFLAGS) -c $(SRC_CONFIG) -o $(OBJ_CONFIG) $(LEX_YACC_FLAGS)
token:
$(CXX) $(CXXFLAGS) -c $(SRC_TOKEN) -o $(OBJ_TOKEN)
lex_yacc_part:
cd data; $(YACC) $(YACCFLAGS) $(YACC_FILE)
cd data; $(LEX) $(LEXFLAGS) $(LEX_FILE)
cd data; sed -i '1s/^/#include "..\/src\/structures\/index.h"\n/' y.tab.h
clean:
-rm -f $(OBJ_INDEX)
-rm -f $(OBJ_COLUMN)
-rm -f $(OBJ_TABLE)
-rm -f $(OBJ_DATABASE)
-rm -f $(OBJ_PROGRAM)
-rm -f data/lex.yy.c
-rm -f data/y.tab.*
-rm -f src/db/config.o
-rm -f $(MAIN)
-rm -f $(OBJ_NETWORK)
-rm -f $(OBJ_INDEXCON)
-rm -f $(OBJ_INDEXSCAN)
-rm -f $(OBJ_OPERATION)
-rm -f $(OBJ_SEQSCAN)