File: Makefile

package info (click to toggle)
js-of-ocaml 5.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,020 kB
  • sloc: ml: 91,250; javascript: 57,289; ansic: 315; makefile: 271; lisp: 23; sh: 6; perl: 4
file content (271 lines) | stat: -rw-r--r-- 8,011 bytes parent folder | download
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
# graphs without precompiled programs:
GRAPHSNOPR = time.pdf time-optim.pdf nativejs.pdf

# graphs with precompiled programs:
GRAPHSPR = size.pdf size-optim.pdf compiletime.pdf

# graphs showing the impact of supporting effects
GRAPHSEFF = time-effects.pdf size-effects.pdf size-bzip2-effects.pdf

# For full benchs:
all: _perf graphsnopr graphspr graphseff _noperf

graphsnopr: _noprecomp $(GRAPHSNOPR)

graphspr: __precomp $(GRAPHSPR)

graphseff: __precomp $(GRAPHSEFF)

# For fast benchs:
test: _perf fastrun $(GRAPHS) _noperf

exes= $(wildcard programs/*)

exesnames = $(exes:programs/%=%)

missingsizesml = $(exesnames:%=results/sizes/ml/%)
missingsizes=$(missingsizesml)

missingcompiletimes = $(exesnames:%=results/compiletimes/`hostname`/byte/%) $(exesnames:%=results/compiletimes/`hostname`/opt/%)

RUN=dune exec ./run.exe --
REPORT=dune exec ./report.exe --

.PHONY: $(GRAPHSNOPR:.pdf=.svg) $(GRAPHSPR:.pdf=.svg) size.gpl _noprecomp

# compile with precompiled programs for creating benchs
__precomp:
	mkdir -p build/byte
	ln -sf $(exes:%=../../%) build/byte
	if [ ! -d precomptmp ] ; then $(RUN) -compile ; else cd precomptmp ; find . -type f -exec mv {} ../{} \; ; fi
	rm -rf precomptmp
	touch __precomp

# for running the test we do not want precompiled programs
__run:
	make _noprecomp
	$(RUN) -all
	touch __run

__run_effects:
	$(RUN) -fast -nobyteopt -effects
	touch __run_effects

fastrun:
	make _noprecomp
	echo "======================== WARNING: fast benchs!"
	$(RUN) -ffast -all
	touch __run

_noprecomp:
	if [ -f __precomp ] ; \
	then \
	  rm -f __precomp ;\
	  mkdir -p precomptmp/build/byte ;\
	  mkdir -p build ;\
	  mkdir -p results ;\
	  find build -type d -exec mkdir -p precomptmp/{} \; ;\
	  find results -type d -exec mkdir -p precomptmp/{} \; ;\
	  for i in $(exesnames) ; do if [ -f build/byte/$$i ] ; then mv -f build/byte/$$i precomptmp/build/byte/ ; fi ; done ;\
	  for i in $(exesnames) ; do for j in build/*/$$i.js ; do if [ -f $$j ] ; then mv $$j precomptmp/$$j ; fi ; done ; done ;\
	  for i in $(exesnames) ; do for j in results/sizes/js_of_ocaml/*/$$i ; do if [ -f $$j ] ; then mv $$j precomptmp/$$j ; fi ; done ; done ;\
	  for i in $(exesnames) ; do for j in results/sizes/*/$$i ; do if [ -f $$j ] ; then mv $$j precomptmp/$$j ; fi ;done ; done ;\
	fi

__missingcompiletimes:
	mkdir -p results/compiletimes/`hostname`/byte/
	for i in $(missingcompiletimes) ; do if [ ! -f $$i ] ; then echo 0 > $$i ; fi ; done
	touch __missingcompiletimes

__missingsizes: __precomp
	for i in $(missingsizes) ; do if [ ! -f $$i ] ; then echo 0 > $$i ; fi ; done
	if [ ! -f results/sizes/ml/ocamlc ] ; then echo 800771 > results/sizes/ml/ocamlc ; fi
	if [ ! -f results/sizes/ml/js_of_ocaml ] ; then echo 171361 > results/sizes/ml/js_of_ocaml ; fi
	if [ ! -f results/sizes/ml/boulderdash ] ; then echo 12920 > results/sizes/ml/boulderdash ; fi
	if [ ! -f results/sizes/ml/cubes ] ; then echo 3773 > results/sizes/ml/cubes ; fi
	if [ ! -f results/sizes/ml/minesweeper ] ; then echo 7106 > results/sizes/ml/minesweeper ; fi
	if [ ! -f results/sizes/ml/planet ] ; then echo 16488 > results/sizes/ml/planet ; fi
	touch __missingsizes

# To generate SVG, we first need to run the benchs,
# then to add data for precompiled programs
time.svg: __run
	$(REPORT) -config report-time.config \
	 -omit binary_trees \
	 -omit fannkuch_redux \
	 -omit loop \
	 -max 5.5 -svg 7 500 150 -edgecaption -ylabel "Execution time" \
	 > $@

size.svg: size.gpl
	gnuplot < $^ > $@

size.gpl: __run __missingsizes
	$(REPORT) -config report-size.config \
	 -omit binary_trees \
	 -omit fannkuch_redux \
	 -omit fannkuch_redux_2 \
	 -omit boyer_no_exc \
	 -omit kb_no_exc \
	 -omit loop \
	 -append boulderdash \
	 -append cubes \
	 -append minesweeper \
	 -append planet \
	 -append js_of_ocaml \
	 -append ocamlc \
	 -max 4.5 -ylabel Size -script \
	 -svg 7 650 150 \
	| perl -pe 'BEGIN{undef $$/;} s/e\nplot/e\nset key at 19.83,2.87\nplot/smg' \
	 > $@
# You'll need to adjust the perl invocation above to align the "Generated code" caption


time-optim.svg: __run
	$(REPORT) -config report-time-optim.config \
	 -omit binary_trees \
	 -omit fannkuch_redux \
	 -omit fannkuch_redux_2 \
	 -omit loop \
	 -max 2.5 -svg 7 400 150 -edgecaption -ylabel "Execution time" \
	 > $@

size-optim.svg: __run __missingsizes
	$(REPORT) -config report-size-optim.config \
	 -omit binary_trees \
	 -omit fannkuch_redux \
	 -omit fannkuch_redux_2 \
	 -omit boyer_no_exc \
	 -omit kb_no_exc \
	 -omit loop \
	 -append boulderdash \
	 -append cubes \
	 -append minesweeper \
	 -append planet \
	 -append js_of_ocaml \
	 -append ocamlc \
	 -max 2.5 -svg 7 650 150 -edgecaption -ylabel Size \
	 > $@

time-effects.svg: __run_effects
	$(REPORT) -config report-time-effects.config \
	 -omit binary_trees \
	 -omit fannkuch_redux \
	 -omit fannkuch_redux_2 \
	 -omit loop \
	 -omit boulderdash \
	 -omit cubes \
	 -omit minesweeper \
	 -omit planet \
	 -omit ocamlc \
	 -min 0.5 -max 1.5 -svg 7 400 150 -edgecaption -ylabel "Execution time" \
	 > $@

size-effects.svg: __run_effects
	$(REPORT) -config report-size-effects.config \
	 -omit binary_trees \
	 -omit fannkuch_redux \
	 -omit fannkuch_redux_2 \
	 -omit boyer_no_exc \
	 -omit kb_no_exc \
	 -omit loop \
	 -append boulderdash \
	 -append cubes \
	 -append minesweeper \
	 -append planet \
	 -append js_of_ocaml \
	 -append ocamlc \
	 -min 0.8 -max 1.25 -svg 7 650 150 -edgecaption -ylabel Size \
	 > $@

size-gzipped-effects.svg: __run_effects
	$(REPORT) -config report-size-gzipped-effects.config \
	 -omit binary_trees \
	 -omit fannkuch_redux \
	 -omit fannkuch_redux_2 \
	 -omit boyer_no_exc \
	 -omit kb_no_exc \
	 -omit loop \
	 -append boulderdash \
	 -append cubes \
	 -append minesweeper \
	 -append planet \
	 -append js_of_ocaml \
	 -append ocamlc \
	 -max 1.2 -min 0.8 -svg 7 650 150 -edgecaption -ylabel Size \
	 > $@

size-bzip2-effects.svg: __run_effects
	$(REPORT) -config report-size-bzip2-effects.config \
	 -omit binary_trees \
	 -omit fannkuch_redux \
	 -omit fannkuch_redux_2 \
	 -omit boyer_no_exc \
	 -omit kb_no_exc \
	 -omit loop \
	 -append boulderdash \
	 -append cubes \
	 -append minesweeper \
	 -append planet \
	 -append js_of_ocaml \
	 -append ocamlc \
	 -max 1.1 -min 0.95 -svg 7 650 150 -edgecaption -ylabel Size \
	 > $@

compiletime.svg: __run __precomp __missingcompiletimes
	$(REPORT) -config report-compiletime.config \
	 -omit binary_trees \
	 -omit fannkuch_redux \
	 -omit loop \
	 -max 2 -svg 7 500 150 -edgecaption -ylabel "Compile time" \
	 > $@

nativejs.svg: __run
	$(REPORT) -config report-nativejs.config \
	 -omit binary_trees \
	 -omit fannkuch_redux \
	 -omit loop \
	 -max 2.8 -svg 7 200 150 -edgecaption -ylabel "Execution time" \
	 > $@


%.pdf: %.svg
	inkscape -D --export-type="pdf" --export-filename="$@" -w 210 -h 297 $<


nativejs.png: nativejs.svg
	inkscape -D -o "$@" -w 500 $<

%.png: %.svg
	inkscape -D -o "$@" -w 1024 $<

_perf:
	for i in /sys/devices/system/cpu/cpu* ; \
	do \
	if [ -f $$i/cpufreq/scaling_governor ] ; then \
		sudo bash -c "echo performance > $$i/cpufreq/scaling_governor" ; \
	fi ; \
	done

_noperf:
	for i in /sys/devices/system/cpu/cpu* ; \
	do \
	if [ -f $$i/cpufreq/scaling_governor ] ; then \
		sudo bash -c "echo powersave > $$i/cpufreq/scaling_governor" ; \
	fi ; \
	done


clean: _noperf
	rm -rf results build __precomp __run __run_effects *.svg *.pdf *~ precomptmp __missingsizes __missingcompiletimes


copy-extra-bc:
	mkdir -p programs
	dune exec ./stripdebug.exe -- $(shell which ocamlc.byte) programs/ocamlc
	dune build --profile bench_no_debug ../compiler/bin-js_of_ocaml/js_of_ocaml.bc ../examples/
	cp -f ../_build/default/compiler/bin-js_of_ocaml/js_of_ocaml.bc programs/js_of_ocaml
	cp -f ../_build/default/examples/boulderdash/boulderdash.bc programs/boulderdash
	cp -f ../_build/default/examples/cubes/cubes.bc programs/cubes
	cp -f ../_build/default/examples/minesweeper/main.bc programs/minesweeper
	cp -f ../_build/default/examples/planet/planet.bc programs/planet