diff --git a/Makefile b/Makefile index 103a5a1..7e8c25c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ PREFIX=/usr/local SCHEME=chibi +R6RSTMP=tmp/${SCHEME}-r6rs +R7RSTMP=tmp/${SCHEME}-r7rs all: build @@ -27,32 +29,32 @@ uninstall: rm -rf ${PREFIX}/lib/compile-r7rs rm -rf ${PREFIX}/bin/compile-r7rs -test-r6rs: - rm -rf /tmp/compile-r7rs-test-result.txt - mkdir -p test - mkdir -p test/snow - mkdir -p test/snow/foo - printf "(library (foo bar) (export baz) (import (rnrs)) (define baz (lambda () (display \"Test successfull\") (newline))))" > test/snow/foo/bar.sls - printf "(import (rnrs) (foo bar)) (baz)" > test/main.sps - cd test && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./snow -o main main.sps - -cd test && ./main > /tmp/compile-r7rs-test-result.txt 2>&1 - @grep "Test successfull" /tmp/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat /tmp/compile-r7rs-test-result.txt && exit 1) +test-r6rs: ${R6RSTMP} + printf "(library (foo bar) (export baz) (import (rnrs)) (define baz (lambda () (display \"Test successfull\") (newline))))" > ${R6RSTMP}/libs/foo/bar.sls + printf "(import (rnrs) (foo bar)) (baz)" > ${R6RSTMP}/main.sps + cd ${R6RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./libs -o main main.sps + -cd ${R6RSTMP} && ./main > ${R6RSTMP}/compile-r7rs-test-result.txt 2>&1 + @grep "Test successfull" ${R6RSTMP}/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat ${R6RSTMP}/compile-r7rs-test-result.txt && exit 1) + +${R6RSTMP}: + mkdir -p ${R6RSTMP} + mkdir -p ${R6RSTMP}/libs test-r6rs-docker: docker build -f Dockerfile.test --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} . docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make clean-test SCHEME=${SCHEME} test-r6rs" -test-r7rs: - rm -rf /tmp/compile-r7rs-test-result.txt - mkdir -p test - mkdir -p test/snow - mkdir -p test/snow/foo - echo "(import (scheme base) (foo bar)) (baz)" > test/main.scm - echo "(define baz (lambda () (display \"Test successfull\") (newline)))" > test/snow/foo/bar.scm - echo "(define-library (foo bar) (import (scheme base) (scheme write)) (export baz) (include \"bar.scm\"))" > test/snow/foo/bar.sld - cd test && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./snow -o main main.scm - -cd test && ./main > /tmp/compile-r7rs-test-result.txt 2>&1 - @grep "Test successfull" /tmp/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat /tmp/compile-r7rs-test-result.txt && exit 1) +test-r7rs: ${R7RSTMP} + echo "(import (scheme base) (foo bar)) (baz)" > ${R7RSTMP}/main.scm + echo "(define baz (lambda () (display \"Test successfull\") (newline)))" > ${R7RSTMP}/libs/foo/bar.scm + echo "(define-library (foo bar) (import (scheme base) (scheme write)) (export baz) (include \"bar.scm\"))" > ${R7RSTMP}/libs/foo/bar.sld + cd ${R7RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./snow -o main main.scm + -cd ${R7RSTMP} && ./main > ${R7RSTMP}/compile-r7rs-test-result.txt 2>&1 + @grep "Test successfull" ${R7RSTMP}/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat ${R7RSTMP}/compile-r7rs-test-result.txt && exit 1) + +${R7RSTMP}: + mkdir -p ${R7RSTMP} + mkdir -p ${R7RSTMP}/libs test-r7rs-docker: docker build -f Dockerfile.test --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .