From 9acd71735c988fd261b92195c9f6552e00e163d4 Mon Sep 17 00:00:00 2001 From: Amirouche Date: Mon, 28 Oct 2019 12:18:09 +0100 Subject: [PATCH 1/3] Makefile: whitespace cleanup --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f2cea23b..07612784 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ COMPILED_LIBS = $(CHIBI_COMPILED_LIBS) $(CHIBI_IO_COMPILED_LIBS) \ lib/scheme/time$(SO) ifndef EXCLUDE_POSIX_LIBS -COMPILED_LIBS += lib/srfi/18/threads$(SO) +COMPILED_LIBS += lib/srfi/18/threads$(SO) endif BASE_INCLUDES = include/chibi/sexp.h include/chibi/features.h include/chibi/install.h include/chibi/bignum.h @@ -154,7 +154,7 @@ sexp-ulimit.o: sexp.c $(BASE_INCLUDES) main.o: main.c $(INCLUDES) $(CC) -c $(XCPPFLAGS) $(XCFLAGS) -o $@ $< -SEXP_OBJS = gc.o sexp.o bignum.o gc_heap.o +SEXP_OBJS = gc.o sexp.o bignum.o gc_heap.o SEXP_ULIMIT_OBJS = gc-ulimit.o sexp-ulimit.o bignum.o gc_heap.o EVAL_OBJS = opcodes.o vm.o eval.o simplify.o @@ -251,7 +251,7 @@ lib/scheme/char/case-offsets.scm: data/UnicodeData.txt chibi-scheme$(EXE) all-li checkdefs: @for d in $(D); do \ if ! $(GREP) -q " SEXP_USE_$${d%%=*} " include/chibi/features.h; then \ - echo "WARNING: unknown definition $$d"; \ + echo "WARNING: unknown definition $$d"; \ fi; \ done @@ -259,9 +259,9 @@ test-basic: chibi-scheme$(EXE) @for f in tests/basic/*.scm; do \ $(CHIBI) -xchibi $$f >$${f%.scm}.out 2>$${f%.scm}.err; \ if $(DIFF) -q $(DIFFOPTS) $${f%.scm}.out $${f%.scm}.res; then \ - echo "[PASS] $${f%.scm}"; \ + echo "[PASS] $${f%.scm}"; \ else \ - echo "[FAIL] $${f%.scm}"; \ + echo "[FAIL] $${f%.scm}"; \ fi; \ done From 61684647d6d5882beb8ec72292931d1781d4a8c6 Mon Sep 17 00:00:00 2001 From: Amirouche Date: Mon, 28 Oct 2019 12:19:37 +0100 Subject: [PATCH 2/3] Makefile: js/chibi.js: disable optimization Optimizations will (sometime) lead to broken build. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 07612784..d3608258 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,7 @@ all: chibi-scheme$(EXE) all-libs chibi-scheme.pc $(META_FILES) js: js/chibi.js js/chibi.js: chibi-scheme-emscripten chibi-scheme-static.bc js/pre.js js/post.js js/exported_functions.json - emcc -O3 chibi-scheme-static.bc -o $@ -s MODULARIZE=1 -s EXPORT_NAME=\"Chibi\" -s EXPORTED_FUNCTIONS=@js/exported_functions.json `find lib -type f \( -name "*.scm" -or -name "*.sld" \) -printf " --preload-file %p"` -s 'EXTRA_EXPORTED_RUNTIME_METHODS=["ccall", "cwrap"]' --pre-js js/pre.js --post-js js/post.js + emcc -O0 chibi-scheme-static.bc -o $@ -s MODULARIZE=1 -s EXPORT_NAME=\"Chibi\" -s EXPORTED_FUNCTIONS=@js/exported_functions.json `find lib -type f \( -name "*.scm" -or -name "*.sld" \) -printf " --preload-file %p"` -s 'EXTRA_EXPORTED_RUNTIME_METHODS=["ccall", "cwrap"]' --pre-js js/pre.js --post-js js/post.js chibi-scheme-static.bc: emmake $(MAKE) PLATFORM=emscripten CHIBI_DEPENDENCIES= CHIBI=./chibi-scheme-emscripten PREFIX= CFLAGS=-O2 SEXP_USE_DL=0 EXE=.bc SO=.bc CPPFLAGS="-DSEXP_USE_STRICT_TOPLEVEL_BINDINGS=1 -DSEXP_USE_ALIGNED_BYTECODE=1 -DSEXP_USE_STATIC_LIBS=1 -DSEXP_USE_STATIC_LIBS_NO_INCLUDE=0" clibs.c chibi-scheme-static.bc From 9604fa361b96ca81628475e6aea5230e7e455748 Mon Sep 17 00:00:00 2001 From: Amirouche Date: Mon, 28 Oct 2019 12:21:37 +0100 Subject: [PATCH 3/3] Makefile: js/chibi.js: ALLOW_MEMORY_GROWTH=1 `ALLOW_MEMORY_GROWTH=1` allows to grow the wasm vm memory space as needed and avoid out-of-memory issues. This is for development purpose, production build will want to set memory size to something that is fit the application (I don't remember the actual option name, but removing ALLOW_MEMORY_GROWTH=1 from the compilation, and re-running the app will display the good option to use). --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d3608258..8d1593db 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,7 @@ all: chibi-scheme$(EXE) all-libs chibi-scheme.pc $(META_FILES) js: js/chibi.js js/chibi.js: chibi-scheme-emscripten chibi-scheme-static.bc js/pre.js js/post.js js/exported_functions.json - emcc -O0 chibi-scheme-static.bc -o $@ -s MODULARIZE=1 -s EXPORT_NAME=\"Chibi\" -s EXPORTED_FUNCTIONS=@js/exported_functions.json `find lib -type f \( -name "*.scm" -or -name "*.sld" \) -printf " --preload-file %p"` -s 'EXTRA_EXPORTED_RUNTIME_METHODS=["ccall", "cwrap"]' --pre-js js/pre.js --post-js js/post.js + emcc -O0 chibi-scheme-static.bc -o $@ -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s EXPORT_NAME=\"Chibi\" -s EXPORTED_FUNCTIONS=@js/exported_functions.json `find lib -type f \( -name "*.scm" -or -name "*.sld" \) -printf " --preload-file %p"` -s 'EXTRA_EXPORTED_RUNTIME_METHODS=["ccall", "cwrap"]' --pre-js js/pre.js --post-js js/post.js chibi-scheme-static.bc: emmake $(MAKE) PLATFORM=emscripten CHIBI_DEPENDENCIES= CHIBI=./chibi-scheme-emscripten PREFIX= CFLAGS=-O2 SEXP_USE_DL=0 EXE=.bc SO=.bc CPPFLAGS="-DSEXP_USE_STRICT_TOPLEVEL_BINDINGS=1 -DSEXP_USE_ALIGNED_BYTECODE=1 -DSEXP_USE_STATIC_LIBS=1 -DSEXP_USE_STATIC_LIBS_NO_INCLUDE=0" clibs.c chibi-scheme-static.bc