Makefile: add REPL invocation rules
This commit is contained in:
parent
33ff3e2dee
commit
854cf2a6ba
2 changed files with 53 additions and 0 deletions
20
Makefile
20
Makefile
|
@ -184,6 +184,11 @@ DOCKER_BUILD = $(foreach impl,$(DO_IMPLS),docker-build^$(impl))
|
|||
|
||||
IMPL_PERF = $(filter-out $(EXCLUDE_PERFS),$(foreach impl,$(DO_IMPLS),perf^$(impl)))
|
||||
|
||||
IMPL_REPL = $(foreach impl,$(DO_IMPLS),repl^$(impl))
|
||||
ALL_REPL = $(strip $(sort \
|
||||
$(foreach impl,$(DO_IMPLS),\
|
||||
$(foreach step,$(STEPS),repl^$(impl)^$(step)))))
|
||||
|
||||
#
|
||||
# Build rules
|
||||
#
|
||||
|
@ -264,3 +269,18 @@ $(IMPL_PERF):
|
|||
$(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal); \
|
||||
echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf3.mal)'; \
|
||||
$(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf3.mal))
|
||||
|
||||
# REPL invocation rules
|
||||
# Allow repl^IMPL^STEP and repl^IMPL (which starts REPL of stepA)
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(IMPL_REPL): $$@^stepA
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(ALL_REPL): $$(call $$(word 2,$$(subst ^, ,$$(@)))_STEP_TO_PROG,$$(word 3,$$(subst ^, ,$$(@))))
|
||||
@$(foreach impl,$(word 2,$(subst ^, ,$(@))),\
|
||||
$(foreach step,$(word 3,$(subst ^, ,$(@))),\
|
||||
cd $(if $(filter mal,$(impl)),$(MAL_IMPL),$(impl)); \
|
||||
echo 'REPL implementation $(impl), step file: $+'; \
|
||||
echo 'Running: $(call $(impl)_RUNSTEP,$(step),$(+))'; \
|
||||
$(call $(impl)_RUNSTEP,$(step),$(+));))
|
||||
|
|
33
README.md
33
README.md
|
@ -651,6 +651,39 @@ make MAL_IMPL=ruby "test^mal^step2"
|
|||
make MAL_IMPL=python "test^mal^step2"
|
||||
```
|
||||
|
||||
### Starting the REPL
|
||||
|
||||
* To start the REPL of an implementation in a specific step:
|
||||
|
||||
```
|
||||
make "repl^IMPL^stepX"
|
||||
|
||||
# e.g
|
||||
make "repl^ruby^step3"
|
||||
make "repl^ps^step4"
|
||||
```
|
||||
|
||||
* If you omit the step, then `stepA` is used:
|
||||
|
||||
```
|
||||
make "repl^IMPL"
|
||||
|
||||
# e.g
|
||||
make "repl^ruby"
|
||||
make "repl^ps"
|
||||
```
|
||||
|
||||
* To start the REPL of the self-hosted implementation, specify `mal` as the
|
||||
REPL implementation and use the `MAL_IMPL` make variable to change the
|
||||
underlying host language (default is JavaScript):
|
||||
```
|
||||
make MAL_IMPL=IMPL "repl^mal^stepX"
|
||||
|
||||
# e.g.
|
||||
make "repl^mal^step2" # js is default
|
||||
make MAL_IMPL=ruby "repl^mal^step2"
|
||||
make MAL_IMPL=python "repl^mal"
|
||||
```
|
||||
|
||||
### Performance tests
|
||||
|
||||
|
|
Loading…
Reference in a new issue