| 1 |
SHELL := /bin/bash |
| 2 |
|
| 3 |
FILES = package.lisp iterate.lisp iterate-test.lisp iterate-pg.lisp iterate.asd |
| 4 |
TEXFILES = doc/iter-man.tex doc/iter-bare.tex doc/aimemo.sty doc/GNUmakefile |
| 5 |
PDFFILES = doc/iter-man.pdf doc/iter-bare.pdf |
| 6 |
defaultLisps = abcl allegro ccl clasp clisp cmucl ecl lispworks sbcl |
| 7 |
ifdef ITERATE_TEST_LISPS |
| 8 |
lisps ?= ${ITERATE_TEST_LISPS} |
| 9 |
else |
| 10 |
lisps ?= ${defaultLisps} |
| 11 |
endif |
| 12 |
|
| 13 |
|
| 14 |
DOCKER ?= docker |
| 15 |
|
| 16 |
sourceDirectory := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) |
| 17 |
|
| 18 |
|
| 19 |
l ?= sbcl |
| 20 |
|
| 21 |
ABCL ?= abcl |
| 22 |
ALLEGRO ?= alisp |
| 23 |
ALLEGROMODERN ?= mlisp |
| 24 |
CCL ?= ccl |
| 25 |
CLISP ?= clisp |
| 26 |
CLASP ?= clasp |
| 27 |
CMUCL ?= cmucl |
| 28 |
ECL ?= ecl |
| 29 |
GCL ?= gcl |
| 30 |
LISPWORKS ?= lispworks |
| 31 |
MKCL ?= mkcl |
| 32 |
SBCL ?= sbcl |
| 33 |
SCL ?= scl |
| 34 |
XCL ?= xcl |
| 35 |
|
| 36 |
ifeq ($(l), abcl) |
| 37 |
command ?= ${ABCL} |
| 38 |
loadfile = --noinit --nosystem --noinform --load |
| 39 |
|
| 40 |
else ifeq ($(l), allegro) |
| 41 |
command ?= ${ALLEGRO} |
| 42 |
loadfile = -q -L |
| 43 |
|
| 44 |
else ifeq ($(l), ccl) |
| 45 |
loadfile = --no-init --quiet --load |
| 46 |
command ?= ${CCL} |
| 47 |
|
| 48 |
else ifeq ($(l), clasp) |
| 49 |
command ?= ${CLASP} |
| 50 |
loadfile = --norc --load |
| 51 |
|
| 52 |
else ifeq ($(l), clisp) |
| 53 |
command ?= ${CLISP} |
| 54 |
loadfile = -norc --silent -ansi |
| 55 |
|
| 56 |
else ifeq ($(l), cmucl) |
| 57 |
command ?= ${CMUCL} |
| 58 |
loadfile = -noinit -batch -load |
| 59 |
|
| 60 |
else ifeq ($(l), ecl) |
| 61 |
command ?= ${ECL} |
| 62 |
loadfile = --norc --load |
| 63 |
|
| 64 |
else ifeq ($(l), lispworks) |
| 65 |
command ?= ${LISPWORKS} # this is just a convention... |
| 66 |
loadfile = -siteinit - -init - -load |
| 67 |
|
| 68 |
else ifeq ($(l), sbcl) |
| 69 |
command ?= ${SBCL} |
| 70 |
loadfile = --no-userinit --no-sysinit --load |
| 71 |
else |
| 72 |
$(error Don\'t know how to operate on implementation $(l)) |
| 73 |
endif |
| 74 |
|
| 75 |
.PHONY: test clear-cache test-all-lisps test-docker-repl test-docker-lisp |
| 76 |
|
| 77 |
distrib: |
| 78 |
tar czf iterate.tgz $(FILES) $(TEXFILES) $(PDFFILES) |
| 79 |
|
| 80 |
clear-cache: |
| 81 |
rm -rf test/cache |
| 82 |
|
| 83 |
test: clear-cache |
| 84 |
mkdir -p test |
| 85 |
set -o pipefail ; \ |
| 86 |
$(command) $(loadfile) test.lisp | tee test/${l}-test.text ; \ |
| 87 |
exit ${PIPESTATUS[0]} |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
test-docker-repl: clear-cache |
| 92 |
@${DOCKER} run --rm -i -t --pull always -u $(shell id -u):$(shell id -g) -v $(sourceDirectory):$(sourceDirectory) -w $(sourceDirectory)/test clfoundation/${l}:latest |
| 93 |
|
| 94 |
test-docker-lisp: clear-cache |
| 95 |
@${DOCKER} run --rm -i -t --pull always -u $(shell id -u):$(shell id -g) -v $(sourceDirectory):$(sourceDirectory) -w $(sourceDirectory) clfoundation/${l}:latest make test l=${l} t=${t} |
| 96 |
|
| 97 |
test-all-lisps: |
| 98 |
@for lisp in ${lisps} ; do ${MAKE} test l=$$lisp t=${t}|| { echo "$${lisp} failed" ; exit 1 ; } ; done |