thesis-lisp/Makefile
Mark Poliakov 91961bcec5 Lots of changes with long commit message again
1. (list ...)
2. string-* functions
3. (native str) to resolve native functions at runtime
4. Memory fuckups in compiler core unit loading
5. Now can call non-identifiers in compiler
2021-04-09 00:18:48 +03:00

60 lines
1.2 KiB
Makefile

O=build
VM_OBJS=$(O)/vm/main.o \
$(O)/vm/vmstate.o \
$(O)/vm/vmstack.o \
$(O)/vm/vmstring.o \
$(O)/vm/vmval.o \
$(O)/vm/load.o \
$(O)/vm/unit.o \
$(O)/vm/stack.o \
$(O)/vm/error.o \
$(O)/vm/debug.o \
$(O)/vm/libcore.o \
$(O)/core/vector.o \
$(O)/core/hash.o
COMPILER_OBJS=$(O)/compiler/main.o \
$(O)/compiler/compile.o \
$(O)/compiler/node.o \
$(O)/compiler/parse.o \
$(O)/compiler/unit.o \
$(O)/compiler/builtin.o \
$(O)/core/vector.o \
$(O)/core/hash.o
CFLAGS=-Icore/include \
-Werror \
-Wall \
-Wextra \
-ggdb \
-O0
HDRS=$(shell find . -type f -name "*.h")
DIRS=$(shell find compiler core vm -type d -printf "$(O)/%p ")
all: $(DIRS) $(O)/l2vm $(O)/l2c
clean:
rm -rf $(O)
$(DIRS):
mkdir -p $@
$(O)/l2vm: $(VM_OBJS)
$(CC) $(LDFLAGS) -o $@ $(VM_OBJS)
$(O)/l2c: $(COMPILER_OBJS)
$(CC) $(LDFLAGS) -o $@ $(COMPILER_OBJS)
$(O)/vm/%.o: vm/%.c $(HDRS)
$(CC) -Ivm/include -c $(CFLAGS) -o $@ $<
$(O)/compiler/%.o: compiler/%.c $(HDRS)
$(CC) -Icompiler/include -c $(CFLAGS) -o $@ $<
$(O)/%.o: %.c $(HDRS)
$(CC) -c $(CFLAGS) -o $@ $<
test: $(DIRS) $(O)/mod1.vmx $(O)/mod2.vmx $(O)/l2vm
cd $(O) && $(L2VM_PREFIX) ./l2vm mod1.vmx
$(O)/%.vmx: %.vml $(O)/l2c
$(O)/l2c $< $@