aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-06-26 19:18:56 +0800
committerMistivia <i@mistivia.com>2025-06-26 19:33:00 +0800
commit0ba662762023b7e3788690d9990ab39e89fd6f34 (patch)
treeade9d378c7a8e7c04ed7242626c07f889686e2a5 /Makefile
parente05a649c3b5b97f04756d8d08f8b8d6b5d8e672c (diff)
add webassembly build; readline dep is optional
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile14
1 files changed, 12 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 1bfc086..47f92ce 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,16 @@
mode ?= debug
cc = gcc
-includes = -I3rdparty/algds/build/include/
+
+includes = -DWITHREADLINE -I3rdparty/algds/build/include/
+#includes = -I3rdparty/algds/build/include/
+
3rdlibs = 3rdparty/algds/build/lib/libalgds.a
ldflags = -lm -lreadline
ifeq ($(mode), debug)
cflags = $(includes) \
-g \
-fsanitize=address
-else
+else ifeq ($(mode), debug)
cflags = $(includes) -g -flto -O2
endif
@@ -19,6 +22,13 @@ tests_bin=$(tests:.c=.bin)
all: bamboo-lisp
+web: web-bamboo-lisp.js
+
+web-bamboo-lisp.js: $(src)
+ -rm web-*
+ emcc -I3rdparty/algds/build/include $(src) 3rdparty/algds/src/*.c -o web-bamboo-lisp.js \
+ -s EXPORTED_FUNCTIONS="['_print_lisp_error', '_malloc', '_free', '_new_interp', '_lisp_to_string', _Interp_eval_string]" -s WASM=1 -s EXPORTED_RUNTIME_METHODS="['stringToUTF8', 'UTF8ToString']"
+
install: bamboo-lisp
sudo cp bamboo-lisp /usr/local/bin/bamboo