VB.Net, C#: fix cmd line arg handling with --raw
[jackhill/mal.git] / Makefile
CommitLineData
31690700
JM
1#
2# Command line settings
3#
4
5MAL_IMPL = js
6
a05f7822
JM
7PYTHON = python
8
31690700
JM
9#
10# Settings
11#
12
891c3f3b 13IMPLS = bash c clojure coffee cs go java js make mal perl php ps \
ee7cd585 14 python r ruby rust vb
31690700
JM
15
16step0 = step0_repl
17step1 = step1_read_print
18step2 = step2_eval
19step3 = step3_env
20step4 = step4_if_fn_do
21step5 = step5_tco
22step6 = step6_file
23step7 = step7_quote
24step8 = step8_macros
01c97316
JM
25step9 = step9_try
26stepA = stepA_interop
31690700 27
cc021efe
JM
28EXCLUDE_TESTS += test^bash^step5 # no stack exhaustion or completion
29EXCLUDE_TESTS += test^c^step5 # segfault
30EXCLUDE_TESTS += test^cs^step5 # fatal stack overflow fault
31EXCLUDE_TESTS += test^make^step5 # no TCO capability/step
32EXCLUDE_TESTS += test^mal^step5 # no TCO capability/step
17e1c5f9 33EXCLUDE_TESTS += test^go^step5 # test completes, even at 100,000
cc021efe
JM
34EXCLUDE_TESTS += test^php^step5 # test completes, even at 100,000
35EXCLUDE_TESTS += test^ruby^step5 # test completes, even at 100,000
a77e2b31 36EXCLUDE_TESTS += test^rust^step5 # no catching stack overflows
cc021efe
JM
37
38# interop tests now implemented yet
01c97316
JM
39EXCLUDE_TESTS += test^cs^stepA test^java^stepA test^mal^stepA \
40 test^mal^step0 test^php^stepA test^ps^stepA \
41 test^python^stepA test^ruby^stepA
cc021efe 42
db4c329a 43EXCLUDE_PERFS = perf^mal # TODO: fix this
31690700
JM
44
45#
46# Utility functions
47#
48
49STEP_TEST_FILES = $(strip $(wildcard $(1)/tests/$($(2)).mal) $(wildcard tests/$($(2)).mal))
50
db4c329a
JM
51bash_STEP_TO_PROG = bash/$($(1)).sh
52c_STEP_TO_PROG = c/$($(1))
31690700 53clojure_STEP_TO_PROG = clojure/src/$($(1)).clj
891c3f3b 54coffee_STEP_TO_PROG = coffee/$($(1)).coffee
db4c329a 55cs_STEP_TO_PROG = cs/$($(1)).exe
69b4abd6 56go_STEP_TO_PROG = go/$($(1))
db4c329a
JM
57java_STEP_TO_PROG = java/src/main/java/mal/$($(1)).java
58js_STEP_TO_PROG = js/$($(1)).js
59make_STEP_TO_PROG = make/$($(1)).mk
60mal_STEP_TO_PROG = mal/$($(1)).mal
b5dedee0 61perl_STEP_TO_PROG = perl/$($(1)).pl
db4c329a
JM
62php_STEP_TO_PROG = php/$($(1)).php
63ps_STEP_TO_PROG = ps/$($(1)).ps
64python_STEP_TO_PROG = python/$($(1)).py
4d1456b9 65r_STEP_TO_PROG = r/$($(1)).r
db4c329a 66ruby_STEP_TO_PROG = ruby/$($(1)).rb
abdd56eb 67rust_STEP_TO_PROG = rust/target/$($(1))
ee7cd585 68vb_STEP_TO_PROG = vb/$($(1)).exe
db4c329a
JM
69
70
71bash_RUNSTEP = bash ../$(2) $(3)
72c_RUNSTEP = ../$(2) $(3)
73clojure_RUNSTEP = lein with-profile +$(1) trampoline run $(3)
891c3f3b 74coffee_RUNSTEP = coffee ../$(2) $(3)
db4c329a 75cs_RUNSTEP = mono ../$(2) --raw $(3)
69b4abd6 76go_RUNSTEP = ../$(2) $(3)
db4c329a
JM
77java_RUNSTEP = mvn -quiet exec:java -Dexec.mainClass="mal.$($(1))" -Dexec.args="--raw$(if $(3), $(3),)"
78js_RUNSTEP = node ../$(2) $(3)
79make_RUNSTEP = make -f ../$(2) $(3)
80mal_RUNSTEP = $(call $(MAL_IMPL)_RUNSTEP,$(1),$(call $(MAL_IMPL)_STEP_TO_PROG,stepA),../$(2),") #"
b5dedee0 81perl_RUNSTEP = perl ../$(2) $(3)
db4c329a 82php_RUNSTEP = php ../$(2) $(3)
01c97316 83ps_RUNSTEP = $(4)gs -q -I./ -dNODISPLAY -- ../$(2) $(3)$(4)
db4c329a 84python_RUNSTEP = $(PYTHON) ../$(2) $(3)
4d1456b9 85r_RUNSTEP = Rscript ../$(2) $(3)
db4c329a 86ruby_RUNSTEP = ruby ../$(2) $(3)
abdd56eb 87rust_RUNSTEP = ../$(2) $(3)
ee7cd585 88vb_RUNSTEP = mono ../$(2) --raw $(3)
db4c329a
JM
89
90# Extra options to pass to runtest.py
91cs_TEST_OPTS = --redirect
aaba2493 92mal_TEST_OPTS = --redirect --start-timeout 60 --test-timeout 120
ee7cd585 93vb_TEST_OPTS = --redirect
31690700
JM
94
95
96# Derived lists
97STEPS = $(sort $(filter step%,$(.VARIABLES)))
98IMPL_TESTS = $(foreach impl,$(IMPLS),test^$(impl))
99STEP_TESTS = $(foreach step,$(STEPS),test^$(step))
100ALL_TESTS = $(filter-out $(EXCLUDE_TESTS),\
101 $(strip $(sort \
102 $(foreach impl,$(IMPLS),\
103 $(foreach step,$(STEPS),test^$(impl)^$(step))))))
104
105IMPL_STATS = $(foreach impl,$(IMPLS),stats^$(impl))
712af9ef 106IMPL_STATS_LISP = $(foreach impl,$(IMPLS),stats-lisp^$(impl))
31690700 107
db4c329a
JM
108IMPL_PERF = $(filter-out $(EXCLUDE_PERFS),$(foreach impl,$(IMPLS),perf^$(impl)))
109
31690700
JM
110#
111# Build rules
112#
113
114# Build a program in 'c' directory
115c/%:
116 $(MAKE) -C $(dir $(@)) $(notdir $(@))
117
118# Allow test, test^STEP, test^IMPL, and test^IMPL^STEP
119.SECONDEXPANSION:
120$(IMPL_TESTS): $$(filter $$@^%,$$(ALL_TESTS))
121
122.SECONDEXPANSION:
123$(STEP_TESTS): $$(foreach step,$$(subst test^,,$$@),$$(filter %^$$(step),$$(ALL_TESTS)))
124
125.SECONDEXPANSION:
126$(ALL_TESTS): $$(call $$(word 2,$$(subst ^, ,$$(@)))_STEP_TO_PROG,$$(word 3,$$(subst ^, ,$$(@))))
127 @$(foreach impl,$(word 2,$(subst ^, ,$(@))),\
128 $(foreach step,$(word 3,$(subst ^, ,$(@))),\
129 cd $(if $(filter mal,$(impl)),$(MAL_IMPL),$(impl)); \
130 $(foreach test,$(call STEP_TEST_FILES,$(impl),$(step)),\
131 echo '----------------------------------------------'; \
132 echo 'Testing $@, step file: $+, test file: $(test)'; \
db4c329a
JM
133 echo 'Running: ../runtest.py $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+))'; \
134 ../runtest.py $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+)))))
31690700
JM
135
136test: $(ALL_TESTS)
137tests: $(ALL_TESTS)
138
139
140# Stats rules
141
db4c329a
JM
142stats: $(IMPL_STATS)
143stats-lisp: $(IMPL_STATS_LISP)
144
31690700
JM
145.SECONDEXPANSION:
146$(IMPL_STATS):
147 @echo "----------------------------------------------"; \
148 $(foreach impl,$(word 2,$(subst ^, ,$(@))),\
149 echo "Stats for $(impl):"; \
150 $(MAKE) --no-print-directory -C $(impl) stats)
151
712af9ef
JM
152.SECONDEXPANSION:
153$(IMPL_STATS_LISP):
154 @echo "----------------------------------------------"; \
155 $(foreach impl,$(word 2,$(subst ^, ,$(@))),\
156 echo "Stats (lisp only) for $(impl):"; \
157 $(MAKE) --no-print-directory -C $(impl) stats-lisp)
158
db4c329a
JM
159
160# Performance test rules
161
162perf: $(IMPL_PERF)
163
164.SECONDEXPANSION:
165$(IMPL_PERF):
166 @echo "----------------------------------------------"; \
167 $(foreach impl,$(word 2,$(subst ^, ,$(@))),\
168 cd $(if $(filter mal,$(impl)),$(MAL_IMPL),$(impl)); \
169 echo "Performance test for $(impl):"; \
170 echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf1.mal)'; \
171 $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf1.mal); \
172 echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal)'; \
173 $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal))
174