aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-12-14 04:12:47 +0800
committerMistivia <i@mistivia.com>2025-12-14 04:13:38 +0800
commitb2f4201cdc8f245c17cdcc2e8028737e3df41512 (patch)
tree52aa67a79a88ea49f0dea742c4e2902484b9ef29
parenta261729300acabc101373199ee49c97e5ea6cbf6 (diff)
restructure
-rw-r--r--Makefile11
-rw-r--r--exts/vector.c (renamed from ext_example/vector.c)0
-rw-r--r--tests/vector.lisp2
3 files changed, 9 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index eb7f945..6d78219 100644
--- a/Makefile
+++ b/Makefile
@@ -13,16 +13,21 @@ endif
src = $(shell find ./ -maxdepth 1 -name '*.c' -not -name 'main.c')
obj = $(src:.c=.o)
+extsrc = $(shell find ./exts/ -maxdepth 1 -name '*.c')
+extobj = $(extsrc:.c=.so)
+
tests=$(shell ls tests/*.c)
tests_bin=$(tests:.c=.bin)
-all: bamboo-lisp ext_example/vector.so $(tests_bin)
+all: bamboo-lisp $(extobj) $(tests_bin)
install: bamboo-lisp libbamboo-lisp.a
sudo cp bamboo-lisp /usr/local/bin/bamboo-lisp
sudo cp libbamboo-lisp.a /usr/local/lib/
sudo mkdir -p /usr/local/include/bamboo_lisp
sudo cp *.h /usr/local/include/bamboo_lisp/
+ sudo mkdir -p /usr/local/share/bamboo-lisp/exts/
+ sudo cp exts/*.so /usr/local/share/bamboo-lisp/exts/
prelude.c: prelude.lisp
cat prelude.lisp | python scripts/genprelude.py > prelude.c
@@ -33,10 +38,10 @@ bamboo-lisp: $(obj) main.o
libbamboo-lisp.a: $(obj)
ar cr $@ $^
-ext_example/vector.so: ext_example/vector.c libbamboo-lisp.a
+$(extobj):%.so:%.c libbamboo-lisp.a
gcc -shared $(cflags) -I./ -o $@ $^ $(ldflags)
-test: bamboo-lisp $(tests_bin) ext_example/vector.so
+test: bamboo-lisp $(tests_bin) exts
@echo
@echo "Run tests:"
@scripts/runall.sh $(tests_bin)
diff --git a/ext_example/vector.c b/exts/vector.c
index 0aa3006..0aa3006 100644
--- a/ext_example/vector.c
+++ b/exts/vector.c
diff --git a/tests/vector.lisp b/tests/vector.lisp
index 10afde4..de22a89 100644
--- a/tests/vector.lisp
+++ b/tests/vector.lisp
@@ -1,4 +1,4 @@
-(loadext "ext_example/vector.so")
+(loadext "exts/vector.so")
(assert (vector? (make-vector)))
(assert (not (vector? 1)))