-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.in
332 lines (240 loc) · 8.16 KB
/
Makefile.in
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
##########################################################################
# #
# Functory: a distributed computing library for Ocaml #
# Copyright (C) 2010 Jean-Christophe Filliatre and Kalyan Krishnamani #
# #
# This software is free software; you can redistribute it and/or #
# modify it under the terms of the GNU Library General Public #
# License version 2.1, with the special exception on linking #
# described in file LICENSE. #
# #
# This software is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #
# #
##########################################################################
# where to install the binaries
prefix=@prefix@
exec_prefix=@exec_prefix@
BINDIR=@bindir@
# where to install the man page
MANDIR=@mandir@
# other variables set by ./configure
OCAMLC = @OCAMLC@
OCAMLOPT = @OCAMLOPT@ -g -annot
OCAMLDEP = @OCAMLDEP@
OCAMLLEX = @OCAMLLEX@
OCAMLYACC= @OCAMLYACC@
OCAMLLIB = @OCAMLLIB@
OCAMLBEST= @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
OCAMLWEB = @OCAMLWEB@
OCAMLWIN32 = @OCAMLWIN32@
EXE = @EXE@
LIBEXT = @LIBEXT@
OBJEXT = @OBJEXT@
INCLUDES =
BFLAGS = -dtypes -g $(INCLUDES)
OFLAGS = -dtypes $(INCLUDES) -for-pack Functory
# main target
#############
NAME = functory
CMA = functory.cma
CMXA = functory.cmxa
TESTDIRS = n-queens sums sort sort-nfs
TESTS := $(patsubst %, tests/%/a.out, $(TESTDIRS))
all: $(OCAMLBEST)
byte: $(CMA)
opt: $(CMA) $(CMXA)
# bytecode and native-code compilation
######################################
CMO = control.cmo sequential.cmo map_fold.cmo \
cores.cmo binary.cmo protocol.cmo network.cmo
CMX = $(CMO:.cmo=.cmx)
GENERATED = version.ml
$(CMA): functory.cmo
$(OCAMLC) -a $(BFLAGS) -o $@ $^
$(CMXA): functory.cmx
$(OCAMLOPT) -a $(OFLAGS) -o $@ $^
functory.cmo: functory.cmi
functory.cmo: $(CMO)
$(OCAMLC) $(BFLAGS) -pack -o $@ $(CMO)
functory.cmx: functory.cmi
functory.cmx: $(CMX)
$(OCAMLOPT) $(INCLUDES) -pack -o $@ $(CMX)
NTCMO = network_test.cmo
NTCMX = $(NTCMO:.cmo=.cmx)
network_test.byte: $(CMA) $(NTCMO)
$(OCAMLC) $(INCLUDES) -o $@ unix.cma $^
network_test.cmx: functory.cmi
network_test.opt: $(CMXA) $(NTCMX)
$(OCAMLOPT) $(INCLUDES) -o $@ unix.cmxa $(CMXA) $(NTCMX)
WTCMO = worker_test.cmo
WTCMX = $(WTCMO:.cmo=.cmx)
worker_test.byte: $(CMA) $(WTCMO)
$(OCAMLC) $(INCLUDES) -o $@ unix.cma $^
worker_test.cmx: functory.cmi
worker_test.opt: $(CMXA) $(WTCMX)
$(OCAMLOPT) $(INCLUDES) -o $@ unix.cmxa $(CMXA) $(WTCMX)
MTCMO = master_test.cmo
MTCMX = $(MTCMO:.cmo=.cmx)
master_test.byte: $(CMA) $(MTCMO)
$(OCAMLC) $(BFLAGS) -o $@ unix.cma $^
master_test.opt: $(CMXA) $(MTCMX)
$(OCAMLOPT) $(INCLUDES) -o $@ unix.cmxa $^
TCMO = test.cmo
TCMX = $(TCMO:.cmo=.cmx)
test.byte: $(CMA) $(TCMO)
$(OCAMLC) $(BFLAGS) -o $@ unix.cma $^
test.opt: $(CMXA) $(TCMX)
$(OCAMLOPT) $(INCLUDES) -o $@ unix.cmxa $^
VERSION=0.4
version.ml: Makefile
echo "let version = \""$(VERSION)"\"" > version.ml
echo "let date = \""`date`"\"" >> version.ml
# tests
#######
tests: $(TESTS)
test: test.opt
WORKER=yes xterm -e "./test.opt" &
sleep 1 && ./test.opt
test-network: network_test.opt
sh ./test-network.sh
test2: master_test.opt worker_test.opt
./worker_test.opt &
sleep 1 && ./master_test.opt && killall -9 worker_test.opt
install-test: tests/fault/a.out
cp tests/fault/a.out ~
install-queens: tests/n-queens/queens64.opt
cp tests/n-queens/queens64.opt ~
install-data-test: tests/data-test/a.out
cp tests/data-test/a.out ~/data.opt
install-mandelbrot: tests/mandelbrot/a.out
cp tests/mandelbrot/a.out ~/mandelbrot.opt
install-provers: tests/provers/a.out
cp tests/provers/a.out ~/disco-provers.opt
tests/%/a.out: tests/%/main.ml functory.cmxa
$(OCAMLOPT) graphics.cmxa unix.cmxa functory.cmxa tests/$*/main.ml -o $@
tests/%.gtk2: tests/%.ml functory.cmxa
$(OCAMLOPT) -I +lablgtk2 lablgtk.cmxa lablgnomecanvas.cmxa unix.cmxa functory.cmxa tests/$*.ml -o $@
tests/%.opt: tests/%.ml functory.cmxa
$(OCAMLOPT) graphics.cmxa unix.cmxa functory.cmxa tests/$*.ml -o $@
tests/pasco/%: tests/pasco/poly.ml tests/pasco/dpoly.ml tests/pasco/%.ml functory.cmxa
$(OCAMLOPT) -I +creal -I tests/pasco/ creal.cmxa unix.cmxa functory.cmxa tests/pasco/poly.ml tests/pasco/dpoly.ml tests/pasco/$*.ml -o $@
install-pasco: tests/pasco/matmul
cp tests/pasco/matmul ~
tests/n-queens/queens64.opt: tests/n-queens/main64.ml functory.cmxa
$(OCAMLOPT) unix.cmxa functory.cmxa tests/n-queens/main64.ml -o $@
wc:
ocamlwc -p *.ml* tests/*/*.ml*
# installation
##############
INSTALL_LIBDIR=$(DESTDIR)$(OCAMLLIB)/functory
install: install-$(OCAMLBEST)
install-byte:
mkdir -p $(INSTALL_LIBDIR)
cp -f functory.mli functory.cmo functory.cmi $(CMA) $(INSTALL_LIBDIR)
install-opt:
mkdir -p $(INSTALL_LIBDIR)
cp -f functory.mli functory.cmo functory.cmi $(CMA) $(INSTALL_LIBDIR)
cp -f functory$(LIBEXT) functory.cmx $(CMXA) $(INSTALL_LIBDIR)
ocamlfind-install:
ocamlfind install functory META $(BUILD)functory.cmi $(CMA) $(CMXA) $(BUILD)functory.a
ocamlfind-remove:
ocamlfind remove functory
# export
########
EXPORTDIR=$(NAME)-$(VERSION)
TAR=$(EXPORTDIR).tar
WWW = $$HOME/WWW/$(NAME)
FILES = *.mli *.ml tests/*/*.ml \
Makefile.in configure configure.in \
.depend README.txt LICENSE CHANGES
export: source export-www export-doc
cp README.txt LICENSE CHANGES $(WWW)
source:
mkdir -p export/$(EXPORTDIR)
cp --parents $(FILES) export/$(EXPORTDIR)
cd export ; tar cf $(TAR) $(EXPORTDIR) ; gzip -f --best $(TAR)
cp export/$(TAR).gz $(WWW)/download/
export-doc: functory.mli
mkdir -p $(WWW)/doc/
ocamldoc -html -hide Functory -d $(WWW)/doc/ functory.mli
WWW_FILES=*.html *.xml Media Scripts About_files Mini-Tutorial_files
export-www:
cd www; cp -rf $(WWW_FILES) $(WWW)
BINARY = $(EXPORTDIR)-$(OSTYPE)
BINARYTAR=$(BINARY).tar
BINARYFILES = README INSTALL COPYING GPL $(NAME).1
binary: $(NAME).$(OCAMLBEST) $(DOCFILES)
mkdir -p export/$(BINARY)
cp $(BINARYFILES) $(DOCFILES) export/$(BINARY)
cp $(NAME).$(OCAMLBEST) export/$(BINARY)/$(NAME)
(cd export; tar czf $(BINARY).tar.gz $(BINARY))
cp export/$(BINARY).tar.gz $(FTP)
# generic rules
###############
.SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly .tex .dvi .ps .html
.mli.cmi:
$(OCAMLC) -c $(BFLAGS) $<
.ml.cmo:
$(OCAMLC) -c $(BFLAGS) $<
.ml.o:
$(OCAMLOPT) -c $(OFLAGS) $<
.ml.cmx:
$(OCAMLOPT) -c $(OFLAGS) $<
.mll.ml:
$(OCAMLLEX) $<
.mly.ml:
$(OCAMLYACC) -v $<
.mly.mli:
$(OCAMLYACC) -v $<
.tex.dvi:
latex $< && latex $<
.dvi.ps:
dvips $< -o $@
.tex.html:
hevea $<
# headers
#########
headers:
headache -c misc/headache_config.txt -h misc/header.txt \
*.in README.txt *.mli *.ml tests/*/*.ml
./config.status
# Emacs tags
############
tags:
find . -name "*.ml*" | sort -r | xargs \
etags "--regex=/let[ \t]+\([^ \t]+\)/\1/" \
"--regex=/let[ \t]+rec[ \t]+\([^ \t]+\)/\1/" \
"--regex=/and[ \t]+\([^ \t]+\)/\1/" \
"--regex=/type[ \t]+\([^ \t]+\)/\1/" \
"--regex=/exception[ \t]+\([^ \t]+\)/\1/" \
"--regex=/val[ \t]+\([^ \t]+\)/\1/" \
"--regex=/module[ \t]+\([^ \t]+\)/\1/"
# Makefile is rebuilt whenever Makefile.in or configure.in is modified
######################################################################
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
configure: configure.in
autoconf
# clean
#######
clean::
rm -f *.cm[iox] *.o *~ *.annot
rm -f $(GENERATED) parser.output
rm -f $(NAME).byte $(NAME).opt
rm -f master_test.byte master_test.opt
rm -f worker_test.byte worker_test.opt
rm -f network_test.byte network_test.opt
rm -f *.aux *.log $(NAME).tex $(NAME).dvi $(NAME).ps
dist-clean distclean:: clean
rm -f Makefile config.cache config.log config.status
# depend
########
.depend depend:: $(GENERATED)
rm -f .depend
$(OCAMLDEP) $(INCLUDES) *.ml *.mli > .depend
include .depend