diff options
| author | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2026-01-18 15:47:48 +0100 |
|---|---|---|
| committer | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2026-01-18 15:47:48 +0100 |
| commit | db3fdda53f16644181a6c68b3e9152af9b300066 (patch) | |
| tree | f9d3c5c9d9f9752582d162d08c9b0d025a6c6ceb /Makefile | |
| parent | b86d3361836935297c6aedb0318ed8a34e4c52f0 (diff) | |
add module system to load .so with load_module builtin
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -1,9 +1,12 @@ LEX = flex YACC = bison CC = gcc -g -CFLAGS = -DYYDEBUG=1 +CFLAGS = -DYYDEBUG=1 -fPIC LIBS = -lreadline -lfl -lm OBJS = lisp.o lisp.tab.o lex.yy.o + +MODULE_SRC = $(wildcard modules/*.c) +MODULE_SO = $(MODULE_SRC:.c=.so) .SUFFIXES: main: main.c $(OBJS) @@ -25,7 +28,7 @@ lex.yy.o: lex.yy.c $(CC) $(CFLAGS) -c lex.yy.c clean: - rm -f *.o main test lisp.tab.c lisp.tab.h lex.yy.c lex.yy.h + rm -f *.o main test lisp.tab.c lisp.tab.h lex.yy.c lex.yy.h modules/*.so test: test.o $(OBJS) $(CC) $(CFLAGS) -o $@ test.o $(OBJS) $(LIBS) @@ -40,4 +43,12 @@ run: main run_std: main ./main lisp/standard_functions.lisp +modules: $(MODULE_SO) + @echo "All modules built successfully." + +modules/%.so: modules/%.c lisp.o + gcc -fPIC -c $< -o $*.o + gcc -fPIC -shared $*.o lisp.o -o $@ + rm $*.o + .PHONY: clean test run |
