Commit | Line | Data |
---|---|---|
31690700 JM |
1 | # |
2 | # Command line settings | |
3 | # | |
4 | ||
5 | MAL_IMPL = js | |
6 | ||
a05f7822 | 7 | PYTHON = python |
47699629 | 8 | USE_MATLAB = |
32d0a1cf JM |
9 | # python, js, cpp, or neko are currently supported |
10 | HAXE_MODE = neko | |
a05f7822 | 11 | |
337c8031 JM |
12 | # Extra options to pass to runtest.py |
13 | TEST_OPTS = | |
14 | ||
17180e85 JM |
15 | # Test with previous test files not just the test files for the |
16 | # current step. Step 0 and 1 tests are special and not included in | |
17 | # later steps. | |
18 | REGRESS= | |
19 | ||
337c8031 JM |
20 | # Extra implementation specific options to pass to runtest.py |
21 | mal_TEST_OPTS = --start-timeout 60 --test-timeout 120 | |
22 | ||
31690700 JM |
23 | # |
24 | # Settings | |
25 | # | |
26 | ||
ae28e856 | 27 | IMPLS = awk bash c d clojure coffee cpp crystal cs erlang elisp elixir es6 \ |
7511317b | 28 | factor forth fsharp go groovy guile haskell haxe io java julia \ |
2faae94c | 29 | js kotlin lua make mal ocaml matlab miniMAL nim objc perl php ps \ |
0eace3df | 30 | python r racket rpython ruby rust scala swift swift3 tcl vb vimscript |
31690700 JM |
31 | |
32 | step0 = step0_repl | |
33 | step1 = step1_read_print | |
34 | step2 = step2_eval | |
35 | step3 = step3_env | |
36 | step4 = step4_if_fn_do | |
37 | step5 = step5_tco | |
38 | step6 = step6_file | |
39 | step7 = step7_quote | |
40 | step8 = step8_macros | |
01c97316 | 41 | step9 = step9_try |
90f618cb | 42 | stepA = stepA_mal |
31690700 | 43 | |
17180e85 JM |
44 | regress_step0 = step0 |
45 | regress_step1 = step1 | |
46 | regress_step2 = step2 | |
47 | regress_step3 = $(regress_step2) step3 | |
48 | regress_step4 = $(regress_step3) step4 | |
49 | regress_step5 = $(regress_step4) step5 | |
50 | regress_step6 = $(regress_step5) step6 | |
51 | regress_step7 = $(regress_step6) step7 | |
52 | regress_step8 = $(regress_step7) step8 | |
53 | regress_step9 = $(regress_step8) step9 | |
54 | regress_stepA = $(regress_step9) stepA | |
55 | ||
56 | STEP5_EXCLUDES += awk # completes at 10,000 | |
57 | STEP5_EXCLUDES += bash # no stack exhaustion or completion | |
58 | STEP5_EXCLUDES += c # segfault | |
59 | STEP5_EXCLUDES += cpp # completes at 10,000 | |
bcfd8b70 | 60 | STEP5_EXCLUDES += crystal # test completes, even at 1,000,000 |
17180e85 JM |
61 | STEP5_EXCLUDES += cs # fatal stack overflow fault |
62 | STEP5_EXCLUDES += d # completes at 10,000, fatal stack overflow at 1,000,000 | |
63 | STEP5_EXCLUDES += erlang # erlang is TCO, test passes | |
64 | STEP5_EXCLUDES += elixir # elixir is TCO, test passes | |
65 | STEP5_EXCLUDES += fsharp # completes at 10,000, fatal stack overflow at 100,000 | |
bcfd8b70 | 66 | STEP5_EXCLUDES += go # test completes, even at 100,000 |
17180e85 | 67 | STEP5_EXCLUDES += haskell # test completes |
3da6f492 | 68 | STEP5_EXCLUDES += io # too slow to complete 10,000 |
17180e85 JM |
69 | STEP5_EXCLUDES += make # no TCO capability/step |
70 | STEP5_EXCLUDES += mal # no TCO capability/step | |
47699629 | 71 | STEP5_EXCLUDES += matlab # too slow to complete 10,000 |
17180e85 JM |
72 | STEP5_EXCLUDES += miniMAL # strange error with runtest.py |
73 | STEP5_EXCLUDES += nim # test completes, even at 100,000 | |
2faae94c | 74 | STEP5_EXCLUDES += objc # completes at 10,000, crashes at 100,000 |
17180e85 JM |
75 | STEP5_EXCLUDES += php # test completes, even at 100,000 |
76 | STEP5_EXCLUDES += racket # test completes | |
77 | STEP5_EXCLUDES += ruby # test completes, even at 100,000 | |
78 | STEP5_EXCLUDES += rust # no catching stack overflows | |
0eace3df | 79 | STEP5_EXCLUDES += swift3 # no catching stack overflows |
17180e85 JM |
80 | STEP5_EXCLUDES += ocaml # test completes, even at 1,000,000 |
81 | STEP5_EXCLUDES += vb # completes at 10,000 | |
17180e85 JM |
82 | |
83 | PERF_EXCLUDES = mal # TODO: fix this | |
31690700 | 84 | |
bcfd8b70 | 85 | dist_EXCLUDES += mal |
5245b079 | 86 | # TODO: still need to implement dist |
bcfd8b70 | 87 | dist_EXCLUDES += guile io julia matlab swift |
5245b079 | 88 | |
31690700 JM |
89 | # |
90 | # Utility functions | |
91 | # | |
92 | ||
47699629 JM |
93 | MATLAB = matlab -nodisplay -nosplash -nodesktop -nojvm -r |
94 | OCTAVE = octave --no-gui -q --traditional --eval | |
95 | matlab_args = $(subst $(SPACE),$(COMMA),$(foreach x,$(strip $(1)),'$(x)')) | |
96 | matlab_cmd = $(if $(strip $(USE_MATLAB)),$(MATLAB),$(OCTAVE)) | |
97 | ||
32d0a1cf JM |
98 | haxe_STEP_TO_PROG_neko = haxe/$($(1)).n |
99 | haxe_STEP_TO_PROG_python = haxe/$($(1)).py | |
100 | haxe_STEP_TO_PROG_cpp = haxe/cpp/$($(1)) | |
101 | haxe_STEP_TO_PROG_js = haxe/$($(1)).js | |
102 | ||
103 | haxe_RUNSTEP_neko = neko ../$(2) $(3) | |
104 | haxe_RUNSTEP_python = python3 ../$(2) $(3) | |
105 | haxe_RUNSTEP_cpp = ../$(2) $(3) | |
106 | haxe_RUNSTEP_js = node ../$(2) $(3) | |
107 | ||
17180e85 JM |
108 | # Return list of test files for a given step. If REGRESS is set then |
109 | # test files will include step 2 tests through tests for the step | |
110 | # being tested. | |
111 | STEP_TEST_FILES = $(strip $(wildcard \ | |
112 | $(foreach s,$(if $(strip $(REGRESS)),$(regress_$(2)),$(2)),\ | |
113 | $(1)/tests/$($(s)).mal tests/$($(s)).mal))) | |
31690700 | 114 | |
17180e85 | 115 | # Map of step (e.g. "step8") to executable file for that step |
3b7ef8c7 | 116 | awk_STEP_TO_PROG = awk/$($(1)).awk |
db4c329a JM |
117 | bash_STEP_TO_PROG = bash/$($(1)).sh |
118 | c_STEP_TO_PROG = c/$($(1)) | |
f82cb965 | 119 | d_STEP_TO_PROG = d/$($(1)) |
31690700 | 120 | clojure_STEP_TO_PROG = clojure/src/$($(1)).clj |
891c3f3b | 121 | coffee_STEP_TO_PROG = coffee/$($(1)).coffee |
9ddaa0b9 | 122 | cpp_STEP_TO_PROG = cpp/$($(1)) |
86fe6314 | 123 | crystal_STEP_TO_PROG = crystal/$($(1)) |
db4c329a | 124 | cs_STEP_TO_PROG = cs/$($(1)).exe |
ae28e856 | 125 | elisp_STEP_TO_PROG = elisp/$($(1)).el |
51c2c1fe | 126 | elixir_STEP_TO_PROG = elixir/lib/mix/tasks/$($(1)).ex |
2cc3804b | 127 | erlang_STEP_TO_PROG = erlang/$($(1)) |
4eb71990 | 128 | es6_STEP_TO_PROG = es6/build/$($(1)).js |
199b1ce7 | 129 | factor_STEP_TO_PROG = factor/$($(1))/$($(1)).factor |
59038a10 | 130 | forth_STEP_TO_PROG = forth/$($(1)).fs |
1c358979 | 131 | fsharp_STEP_TO_PROG = fsharp/$($(1)).exe |
69b4abd6 | 132 | go_STEP_TO_PROG = go/$($(1)) |
a9cd6543 | 133 | groovy_STEP_TO_PROG = groovy/$($(1)).groovy |
36e287b5 | 134 | java_STEP_TO_PROG = java/target/classes/mal/$($(1)).class |
b76aa73b | 135 | haskell_STEP_TO_PROG = haskell/$($(1)) |
32d0a1cf | 136 | haxe_STEP_TO_PROG = $(haxe_STEP_TO_PROG_$(HAXE_MODE)) |
7511317b | 137 | io_STEP_TO_PROG = io/$($(1)).io |
a23e0cdb | 138 | julia_STEP_TO_PROG = julia/$($(1)).jl |
db4c329a | 139 | js_STEP_TO_PROG = js/$($(1)).js |
53c2ea70 | 140 | kotlin_STEP_TO_PROG = kotlin/$($(1)).jar |
9d42904e | 141 | lua_STEP_TO_PROG = lua/$($(1)).lua |
db4c329a JM |
142 | make_STEP_TO_PROG = make/$($(1)).mk |
143 | mal_STEP_TO_PROG = mal/$($(1)).mal | |
59d10e1b | 144 | ocaml_STEP_TO_PROG = ocaml/$($(1)) |
9a54ea18 | 145 | matlab_STEP_TO_PROG = matlab/$($(1)).m |
c1fe72ae | 146 | miniMAL_STEP_TO_PROG = miniMAL/$($(1)).json |
dbac60df | 147 | nim_STEP_TO_PROG = nim/$($(1)) |
2faae94c | 148 | objc_STEP_TO_PROG = objc/$($(1)) |
b5dedee0 | 149 | perl_STEP_TO_PROG = perl/$($(1)).pl |
db4c329a JM |
150 | php_STEP_TO_PROG = php/$($(1)).php |
151 | ps_STEP_TO_PROG = ps/$($(1)).ps | |
152 | python_STEP_TO_PROG = python/$($(1)).py | |
4d1456b9 | 153 | r_STEP_TO_PROG = r/$($(1)).r |
f5223195 | 154 | racket_STEP_TO_PROG = racket/$($(1)).rkt |
80320efc | 155 | rpython_STEP_TO_PROG = rpython/$($(1)) |
db4c329a | 156 | ruby_STEP_TO_PROG = ruby/$($(1)).rb |
434516e0 | 157 | rust_STEP_TO_PROG = rust/target/release/$($(1)) |
821930db | 158 | scala_STEP_TO_PROG = scala/$($(1)).scala |
2539e6af | 159 | swift_STEP_TO_PROG = swift/$($(1)) |
0eace3df | 160 | swift3_STEP_TO_PROG = swift3/$($(1)) |
54d9903c | 161 | tcl_STEP_TO_PROG = tcl/$($(1)).tcl |
ee7cd585 | 162 | vb_STEP_TO_PROG = vb/$($(1)).exe |
50a964ce | 163 | vimscript_STEP_TO_PROG = vimscript/$($(1)).vim |
5eb1f5cb | 164 | guile_STEP_TO_PROG = guile/$($(1)).scm |
db4c329a | 165 | |
17180e85 | 166 | |
c4033aab JM |
167 | # Needed some argument munging |
168 | COMMA = , | |
169 | noop = | |
170 | SPACE = $(noop) $(noop) | |
d1596ac2 | 171 | export FACTOR_ROOTS := . |
db4c329a | 172 | |
17180e85 JM |
173 | # Macro for running a step: |
174 | # $(1): step (e.g. "stepA") | |
175 | # $(2): program for step (e.g. result of *_STEP_TO_PROG | |
176 | # $(3): program arguments | |
3b7ef8c7 | 177 | awk_RUNSTEP = awk -O -f ../$(2) $(3) |
db4c329a JM |
178 | bash_RUNSTEP = bash ../$(2) $(3) |
179 | c_RUNSTEP = ../$(2) $(3) | |
f82cb965 | 180 | d_RUNSTEP = ../$(2) $(3) |
db4c329a | 181 | clojure_RUNSTEP = lein with-profile +$(1) trampoline run $(3) |
891c3f3b | 182 | coffee_RUNSTEP = coffee ../$(2) $(3) |
9ddaa0b9 | 183 | cpp_RUNSTEP = ../$(2) $(3) |
86fe6314 | 184 | crystal_RUNSTEP = ../$(2) $(3) |
db4c329a | 185 | cs_RUNSTEP = mono ../$(2) --raw $(3) |
ae28e856 | 186 | elisp_RUNSTEP = emacs -Q --batch --load ../$(2) $(3) |
df2ca97b | 187 | elixir_RUNSTEP = mix $(notdir $(basename $(2))) $(3) |
2cc3804b | 188 | erlang_RUNSTEP = ../$(2) $(3) |
4eb71990 | 189 | es6_RUNSTEP = node ../$(2) $(3) |
389c9b8a | 190 | factor_RUNSTEP = factor ../$(2) $(3) |
59038a10 | 191 | forth_RUNSTEP = gforth ../$(2) $(3) |
1c358979 | 192 | fsharp_RUNSTEP = mono ../$(2) --raw $(3) |
69b4abd6 | 193 | go_RUNSTEP = ../$(2) $(3) |
a9cd6543 | 194 | groovy_RUNSTEP = groovy ../$(2) $(3) |
5245b079 JM |
195 | # needs TERM=dumb to work with readline |
196 | guile_RUNSTEP = guile --no-auto-compile -L ../guile ../$(2) $(3) | |
b76aa73b | 197 | haskell_RUNSTEP = ../$(2) $(3) |
6c4c14bd | 198 | haxe_RUNSTEP = python3 ../$(2) $(3) |
32d0a1cf | 199 | haxe_RUNSTEP = $(haxe_RUNSTEP_$(HAXE_MODE)) |
7511317b | 200 | io_RUNSTEP = io ../$(2) $(3) |
798206ac | 201 | java_RUNSTEP = mvn -quiet exec:java -Dexec.mainClass="mal.$($(1))" $(if $(3), -Dexec.args="$(3)",) |
a23e0cdb | 202 | julia_RUNSTEP = ../$(2) $(3) |
db4c329a | 203 | js_RUNSTEP = node ../$(2) $(3) |
53c2ea70 | 204 | kotlin_RUNSTEP = java -jar ../$(2) $(3) |
798206ac | 205 | lua_RUNSTEP = ../$(2) $(3) |
db4c329a | 206 | make_RUNSTEP = make -f ../$(2) $(3) |
922d4c3b | 207 | mal_RUNSTEP = $(call $(MAL_IMPL)_RUNSTEP,stepA,$(call $(MAL_IMPL)_STEP_TO_PROG,stepA),../$(2),") #" |
59d10e1b | 208 | ocaml_RUNSTEP = ../$(2) $(3) |
47699629 | 209 | matlab_RUNSTEP = $(matlab_cmd) "$($(1))($(call matlab_args,$(3)));quit;" |
c1fe72ae | 210 | miniMAL_RUNSTEP = miniMAL ../$(2) $(3) |
dbac60df | 211 | nim_RUNSTEP = ../$(2) $(3) |
2faae94c | 212 | objc_RUNSTEP = ../$(2) $(3) |
82acd3de | 213 | perl_RUNSTEP = perl ../$(2) $(3) |
db4c329a | 214 | php_RUNSTEP = php ../$(2) $(3) |
406761e7 | 215 | ps_RUNSTEP = gs -q -I./ -dNODISPLAY -- ../$(2) $(3) |
db4c329a | 216 | python_RUNSTEP = $(PYTHON) ../$(2) $(3) |
4d1456b9 | 217 | r_RUNSTEP = Rscript ../$(2) $(3) |
f5223195 | 218 | racket_RUNSTEP = ../$(2) $(3) |
80320efc | 219 | rpython_RUNSTEP = ../$(2) $(3) |
db4c329a | 220 | ruby_RUNSTEP = ruby ../$(2) $(3) |
abdd56eb | 221 | rust_RUNSTEP = ../$(2) $(3) |
821930db | 222 | scala_RUNSTEP = sbt 'run-main $($(1))$(if $(3), $(3),)' |
2539e6af | 223 | swift_RUNSTEP = ../$(2) $(3) |
0eace3df | 224 | swift3_RUNSTEP = ../$(2) $(3) |
576ef370 | 225 | tcl_RUNSTEP = tclsh ../$(2) --raw $(3) |
ee7cd585 | 226 | vb_RUNSTEP = mono ../$(2) --raw $(3) |
50a964ce | 227 | vimscript_RUNSTEP = ./run_vimscript.sh ../$(2) $(3) |
db4c329a | 228 | |
31690700 | 229 | |
50a964ce DM |
230 | vimscript_TEST_OPTS = --test-timeout 30 |
231 | ifeq ($(MAL_IMPL),vimscript) | |
232 | mal_TEST_OPTS = --start-timeout 60 --test-timeout 180 | |
233 | endif | |
31690700 JM |
234 | |
235 | # Derived lists | |
236 | STEPS = $(sort $(filter step%,$(.VARIABLES))) | |
8569b2af JM |
237 | DO_IMPLS = $(filter-out $(SKIP_IMPLS),$(IMPLS)) |
238 | IMPL_TESTS = $(foreach impl,$(DO_IMPLS),test^$(impl)) | |
31690700 | 239 | STEP_TESTS = $(foreach step,$(STEPS),test^$(step)) |
17180e85 | 240 | ALL_TESTS = $(filter-out $(foreach impl,$(STEP5_EXCLUDES),test^$(impl)^step5),\ |
31690700 | 241 | $(strip $(sort \ |
8569b2af | 242 | $(foreach impl,$(DO_IMPLS),\ |
31690700 JM |
243 | $(foreach step,$(STEPS),test^$(impl)^$(step)))))) |
244 | ||
cf1d3eae JM |
245 | DOCKER_BUILD = $(foreach impl,$(DO_IMPLS),docker-build^$(impl)) |
246 | ||
17180e85 | 247 | IMPL_PERF = $(foreach impl,$(filter-out $(PERF_EXCLUDES),$(DO_IMPLS)),perf^$(impl)) |
db4c329a | 248 | |
854cf2a6 DM |
249 | IMPL_REPL = $(foreach impl,$(DO_IMPLS),repl^$(impl)) |
250 | ALL_REPL = $(strip $(sort \ | |
251 | $(foreach impl,$(DO_IMPLS),\ | |
252 | $(foreach step,$(STEPS),repl^$(impl)^$(step))))) | |
253 | ||
31690700 JM |
254 | # |
255 | # Build rules | |
256 | # | |
257 | ||
4fc7a281 | 258 | # Build a program in an implementation directory |
f045aba1 JM |
259 | # Make sure we always try and build first because the dependencies are |
260 | # encoded in the implementation Makefile not here | |
261 | .PHONY: $(foreach i,$(DO_IMPLS),$(foreach s,$(STEPS),$(call $(i)_STEP_TO_PROG,$(s)))) | |
4fc7a281 | 262 | $(foreach i,$(DO_IMPLS),$(foreach s,$(STEPS),$(call $(i)_STEP_TO_PROG,$(s)))): |
f045aba1 JM |
263 | $(foreach impl,$(word 1,$(subst /, ,$(@))),\ |
264 | $(MAKE) -C $(impl) $(subst $(impl)/,,$(@))) | |
9ddaa0b9 | 265 | |
31690700 JM |
266 | # Allow test, test^STEP, test^IMPL, and test^IMPL^STEP |
267 | .SECONDEXPANSION: | |
268 | $(IMPL_TESTS): $$(filter $$@^%,$$(ALL_TESTS)) | |
269 | ||
270 | .SECONDEXPANSION: | |
271 | $(STEP_TESTS): $$(foreach step,$$(subst test^,,$$@),$$(filter %^$$(step),$$(ALL_TESTS))) | |
272 | ||
273 | .SECONDEXPANSION: | |
274 | $(ALL_TESTS): $$(call $$(word 2,$$(subst ^, ,$$(@)))_STEP_TO_PROG,$$(word 3,$$(subst ^, ,$$(@)))) | |
275 | @$(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
276 | $(foreach step,$(word 3,$(subst ^, ,$(@))),\ | |
277 | cd $(if $(filter mal,$(impl)),$(MAL_IMPL),$(impl)); \ | |
278 | $(foreach test,$(call STEP_TEST_FILES,$(impl),$(step)),\ | |
279 | echo '----------------------------------------------'; \ | |
280 | echo 'Testing $@, step file: $+, test file: $(test)'; \ | |
fc4c7889 JM |
281 | echo 'Running: ../runtest.py $(TEST_OPTS) $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+))'; \ |
282 | ../runtest.py $(TEST_OPTS) $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+));))) | |
31690700 JM |
283 | |
284 | test: $(ALL_TESTS) | |
285 | tests: $(ALL_TESTS) | |
286 | ||
287 | ||
288 | # Stats rules | |
289 | ||
db4c329a JM |
290 | stats: $(IMPL_STATS) |
291 | stats-lisp: $(IMPL_STATS_LISP) | |
292 | ||
31690700 JM |
293 | .SECONDEXPANSION: |
294 | $(IMPL_STATS): | |
295 | @echo "----------------------------------------------"; \ | |
296 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
297 | echo "Stats for $(impl):"; \ | |
298 | $(MAKE) --no-print-directory -C $(impl) stats) | |
299 | ||
712af9ef JM |
300 | .SECONDEXPANSION: |
301 | $(IMPL_STATS_LISP): | |
302 | @echo "----------------------------------------------"; \ | |
303 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
304 | echo "Stats (lisp only) for $(impl):"; \ | |
305 | $(MAKE) --no-print-directory -C $(impl) stats-lisp) | |
306 | ||
b6dc3e37 JM |
307 | # dist rules |
308 | ||
309 | dist: $(IMPL_DIST) | |
310 | ||
311 | .SECONDEXPANSION: | |
312 | $(IMPL_DIST): | |
313 | @echo "----------------------------------------------"; \ | |
314 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
315 | echo "Running: make -C $(impl) dist"; \ | |
316 | $(MAKE) --no-print-directory -C $(impl) dist) | |
317 | ||
cf1d3eae JM |
318 | # Docker build rules |
319 | ||
320 | docker-build: $(DOCKER_BUILD) | |
321 | ||
322 | .SECONDEXPANSION: | |
323 | $(DOCKER_BUILD): | |
324 | echo "----------------------------------------------"; \ | |
325 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
f7824465 JM |
326 | echo "Running: docker build -t kanaka/mal-test-$(impl) .:"; \ |
327 | cd $(impl) && docker build -t kanaka/mal-test-$(impl) .) | |
db4c329a JM |
328 | |
329 | # Performance test rules | |
330 | ||
331 | perf: $(IMPL_PERF) | |
332 | ||
333 | .SECONDEXPANSION: | |
334 | $(IMPL_PERF): | |
335 | @echo "----------------------------------------------"; \ | |
336 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
337 | cd $(if $(filter mal,$(impl)),$(MAL_IMPL),$(impl)); \ | |
338 | echo "Performance test for $(impl):"; \ | |
339 | echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf1.mal)'; \ | |
340 | $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf1.mal); \ | |
341 | echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal)'; \ | |
699f0ad2 JM |
342 | $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal); \ |
343 | echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf3.mal)'; \ | |
344 | $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf3.mal)) | |
854cf2a6 DM |
345 | |
346 | # REPL invocation rules | |
347 | # Allow repl^IMPL^STEP and repl^IMPL (which starts REPL of stepA) | |
348 | ||
349 | .SECONDEXPANSION: | |
350 | $(IMPL_REPL): $$@^stepA | |
351 | ||
352 | .SECONDEXPANSION: | |
353 | $(ALL_REPL): $$(call $$(word 2,$$(subst ^, ,$$(@)))_STEP_TO_PROG,$$(word 3,$$(subst ^, ,$$(@)))) | |
354 | @$(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
355 | $(foreach step,$(word 3,$(subst ^, ,$(@))),\ | |
356 | cd $(if $(filter mal,$(impl)),$(MAL_IMPL),$(impl)); \ | |
357 | echo 'REPL implementation $(impl), step file: $+'; \ | |
358 | echo 'Running: $(call $(impl)_RUNSTEP,$(step),$(+))'; \ | |
359 | $(call $(impl)_RUNSTEP,$(step),$(+));)) | |
bcfd8b70 JM |
360 | |
361 | ||
362 | # Recursive rules (call make FOO in each subdirectory) | |
363 | ||
364 | define recur_template | |
365 | .PHONY: $(1) | |
366 | $(1): $(2) | |
367 | .SECONDEXPANSION: | |
368 | $(2): | |
369 | @echo "----------------------------------------------"; \ | |
370 | $$(foreach impl,$$(word 2,$$(subst ^, ,$$(@))),\ | |
371 | echo "Running: $$(MAKE) --no-print-directory -C $$(impl) $(1)"; \ | |
372 | $$(MAKE) --no-print-directory -C $$(impl) $(1)) | |
373 | endef | |
374 | ||
375 | recur_impls_ = $(filter-out $(foreach impl,$($(1)_EXCLUDES),$(1)^$(impl)),$(foreach impl,$(IMPLS),$(1)^$(impl))) | |
376 | ||
377 | # recursive clean | |
378 | $(eval $(call recur_template,clean,$(call recur_impls_,clean))) | |
379 | ||
380 | # recursive stats | |
381 | $(eval $(call recur_template,stats,$(call recur_impls_,stats))) | |
382 | $(eval $(call recur_template,stats-lisp,$(call recur_impls_,stats-lisp))) | |
383 | ||
384 | # recursive dist | |
385 | $(eval $(call recur_template,dist,$(call recur_impls_,dist))) | |
386 |