-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmakefile
268 lines (217 loc) · 6.74 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
include makefile.inc
FILES=\
src/util/Debug\
src/util/ListAsSet\
src/util/ListExtras\
src/util/ListAsFunction\
src/util/HyperGraph\
src/util/Fixpoint\
src/util/ExternalCompiler\
src/util/SourceCode\
src/util/FreshVariable\
src/util/ParsingExtras\
src/global/Type\
src/global/Constants\
src/global/Schema\
src/global/Functions\
src/sql/Sql\
src/sql/SqlClient\
src/ring/Ring\
src/ring/Arithmetic\
src/calculus/Calculus\
src/calculus/CalculusPrinter\
src/calculus/CalculusDecomposition\
src/calculus/CalculusTransforms\
src/calculus/CalculusDomains\
src/calculus/CalculusDeltas\
src/calculus/SqlToCalculus\
src/calculus/Provenance\
src/compiler/Plan\
src/compiler/IVC\
src/compiler/Heuristics\
src/compiler/Compiler\
src/maps/M3\
src/maps/DistributedM3\
src/global/Partitioner\
src/maps/AnnotatedM3\
src/maps/M3DM\
src/maps/M3Patterns\
src/functional/K3\
src/functional/K3Typechecker\
src/functional/M3ToK3\
src/functional/DMToK3\
src/functional/K3Optimizer\
src/functional/K3Codegen\
src/functional/K3Compiler\
src/imperative/Imperative\
src/imperative/K3ToImperative\
src/imperative/ImperativeCompiler\
src/lib/Sources\
src/lib/StandardFunctions\
src/lib/StandardAdaptors\
src/lib/SliceableMap\
src/lib/Values\
src/lib/Database\
src/lib/DBChecker\
src/lib/Runtime\
src/codegen/K3Interpreter\
src/codegen/K3Scalagen\
TOPLEVEL_FILES=\
src/global/Driver\
src/global/UnitTest\
LEXERS=\
src/parsers/Sqllexer\
src/parsers/Calculuslexer\
src/parsers/K3lexer\
PARSERS=\
src/parsers/Sqlparser\
src/parsers/Calculusparser\
src/parsers/K3parser\
DIRS=\
src/util\
src/global\
src/parsers\
src/sql\
src/ring\
src/calculus\
src/compiler\
src/maps\
src/functional\
src/imperative\
src/codegen\
src/lib
INCLUDE_OBJ=\
str.cma\
unix.cma
#################################################
BASE_FILES := $(FILES)
GENERATED_FILES = $(PARSERS) $(LEXERS)
FILES += $(GENERATED_FILES)
C_FILES =$(patsubst %,%.cmo,$(FILES))
C_INCLUDES =$(patsubst %,%.cmi,$(FILES))
O_FILES =$(patsubst %,%.cmx,$(FILES))
O_INCLUDES =$(patsubst %,%.cmxi,$(FILES))
OCAML_FLAGS +=\
$(patsubst %, -I %,$(DIRS)) \
$(INCLUDE_OBJ)
OPT_FLAGS +=\
$(patsubst %, -I %,$(DIRS))\
$(patsubst %.cma,%.cmxa,$(INCLUDE_OBJ))
#################################################
all: makefile.local versioncheck bin/dbtoaster_top bin/dbtoaster_debug \
bin/dbtoaster_release bin/dbtoaster runtimelibs
versioncheck:
@if [ $(shell ocaml -version | sed 's/.*version \(.*\)$$/\1/' | \
awk -F. '{print ($$1+1000) ($$2+1000) ($$3+1000)}')\
-lt 100310121001 ] ; then \
echo "Your OCaml version is too low. OCaml 3.12.1 is required, you have"\
$(shell ocaml -version); exit -1; fi
runtimelibs: $(O_FILES) $(C_FILES)
@echo Making Runtime Libraries
@make -C lib runtimelibs
lib/.deps: runtimelibs
@echo Making Library Dependencies
@make -C lib dependencies
@touch lib/.deps
bin/dbtoaster_release: $(O_FILES) lib/.deps src/global/Driver.ml bin/dbtoaster_debug
@echo "Linking DBToaster (Optimized)"
@$(OCAMLOPT) $(OPT_FLAGS) -o $@ $(O_FILES) src/global/Driver.ml;
#@if uname | grep -i cygwin ; then \
# cp bin/dbtoaster_debug bin/dbtoaster_release; \
#else \
# $(OCAMLOPT) $(OPT_FLAGS) -o $@ $(O_FILES) src/global/Driver.ml; \
#fi
bin/dbtoaster_debug: $(C_FILES) lib/.deps src/global/Driver.ml
@echo "Linking DBToaster (Debug)"
@$(OCAMLCC) $(OCAML_FLAGS) -o $@ $(C_FILES) src/global/Driver.ml
bin/dbtoaster_top: $(C_FILES) lib/.deps src/global/UnitTest.ml
@echo "Linking DBToaster Top"
@$(OCAMLMKTOP) $(OCAML_FLAGS) -o $@ $(C_FILES) src/global/UnitTest.ml
bin/dbtoaster: bin/dbtoaster_release
fast: bin/dbtoaster_debug bin/dbtoaster_top
dist: bin/dbtoaster
make -C dist
disttest: bin/dbtoaster
make -C dist test
#################################################
states: $(patsubst %,%.states,$(PARSERS))
doc: $(C_FILES) $(patsubst %,%.ml,$(TOPLEVEL_FILES))
@FILES="$(patsubst %,../%.ml,$(FILES) $(TOPLEVEL_FILES))"\
DIRS="$(patsubst %,../%,$(DIRS))"\
make -C doc
#################################################
test: bin/dbtoaster_top bin/dbtoaster
@make -C test $(TEST__target)
localtest: bin/dbtoaster_top
@make -C test local
querytest: bin/dbtoaster
@make -C test query bigquery
queries: bin/dbtoaster
make -C test/queries
#################################################
$(C_FILES) : %.cmo : %.ml
@if [ -f $(*).mli ] ; then \
echo Compiling Header $(*);\
$(OCAMLCC) $(OCAML_FLAGS) -c $(*).mli;\
fi
@echo Compiling $(*)
@$(OCAMLCC) $(OCAML_FLAGS) -c $<
$(O_FILES) : %.cmx : %.ml
@if [ -f $(*).mli ] ; then \
echo Compiling Optimized Header $(*);\
$(OCAMLOPT) $(OPT_FLAGS) -c $(*).mli;\
fi
@echo Compiling Optimized $(*)
@$(OCAMLOPT) $(OPT_FLAGS) -c $<
$(patsubst %,%.ml,$(LEXERS)) : %.ml : %.mll
@echo Building Lexer $(*)
@$(OCAMLLEX) $< 2>&1 | sed 's/^/ /'
$(patsubst %,%.ml,$(PARSERS)) : %.ml : %.mly
@echo Building Parser $(*)
@$(OCAMLYACC) $< 2>&1 | sed 's/^/ /'
$(patsubst %,%.states,$(PARSERS)) : %.states : %.mly
@echo Extracting State Transitions For $(*)
@$(OCAMLYACC) -v $< 2>&1 | sed 's/^/ /'
mv $(*).output $@
# Ignore generated CMI dependencies. They get autocompiled along with the
# object files
$(patsubst %,%.cmi,$(FILES)) :
$(patsubst %,%.cmxi,$(FILES)) :
#################################################
makefile.deps: makefile $(patsubst %,%.ml,$(BASE_FILES))
@echo Computing Dependency Graph
@$(OCAMLDEP) $(patsubst %, -I %,$(DIRS)) \
$(patsubst %,%.ml,$(BASE_FILES)) | tr \\\\ / | sed 's:/$$:\\: '> $@
makefile.local:
@echo Initializing local configuration file
@cp config/makefile.local.default makefile.local
include makefile.deps
include makefile.parserdeps
include makefile.local
#################################################
clean:
rm -f $(patsubst %,%.ml,$(GENERATED_FILES))
rm -f $(patsubst %,%.mli,$(PARSERS))
rm -f $(patsubst %,%.states,$(PARSERS))
rm -f $(C_FILES) $(C_INCLUDES)
rm -f $(O_FILES) $(O_INCLUDES)
rm -f $(patsubst %,%.o,$(FILES))
rm -f $(patsubst %,%.annot,$(FILES))
rm -f bin/dbtoaster_release bin/dbtoaster_top bin/dbtoaster_debug
rm -f src/global/*.cmi src/global/*.cmo src/global/*.annot src/global/Driver.cmx
rm -f src/global/Driver.cmxi src/global/Driver.o
rm -f doc/*.aux doc/*.synctex.gz doc/*.log
rm -f makefile.deps
make -C lib clean
make -C dist clean
rm -f lib/.deps
superclean: clean
rm -f $(shell find src -name "*.cmi") $(shell find src -name "*.cmo")
rm -f $(shell find src -name "*.cmxi") $(shell find src -name "*.cmx")
rm -f $(shell find src -name "*.annot") $(shell find src -name "*.o")
distclean: superclean
make -C doc clean
make -C test/queries clean
#################################################
.PHONY: all clean distclean test states doc runtimelibs fast querytest queries\
versioncheck localtest superclean dist