1
0
Fork 0
lesson-lisp/Makefile
2023-05-06 22:32:06 +04:00

62 lines
1.5 KiB
Makefile

all: test
CAT = cat
CC = gcc
DIFF_Q = diff -q
RM_F = rm -f
CFLAGS = -Wall -Wextra
OBJS = \
src/builtins.c.o \
src/ctype.c.o \
src/eval.c.o \
src/lexer.c.o \
src/object.c.o \
src/parser.c.o \
src/syntax.c.o \
src/tokens.c.o
TEST_OUTS = \
tests/arithm_ops.out \
tests/basic_data_structs.out \
tests/hello.out \
tests/arcana.out \
tests/equiv.out \
tests/logic_ops.out \
tests/syntax.out \
tests/type_conv.out \
tests/type_preds.out
MAIN_OBJS = $(OBJS) src/main.c.o
TEST_OBJS = $(OBJS) src/main-test.c.o
repl: arcana-lisp
./arcana-lisp
test: arcana-lisp-test $(TEST_OUTS)
./arcana-lisp-test
$(DIFF_Q) tests/arithm_ops.txt tests/arithm_ops.out
$(DIFF_Q) tests/basic_data_structs.txt tests/basic_data_structs.out
$(DIFF_Q) tests/hello.txt tests/hello.out
$(DIFF_Q) tests/arcana.txt tests/arcana.out
$(DIFF_Q) tests/equiv.txt tests/equiv.out
$(DIFF_Q) tests/logic_ops.txt tests/logic_ops.out
$(DIFF_Q) tests/syntax.txt tests/syntax.out
$(DIFF_Q) tests/type_conv.txt tests/type_conv.out
$(DIFF_Q) tests/type_preds.txt tests/type_preds.out
clean:
$(RM_F) arcana-lisp arcana-lisp-test $(MAIN_OBJS) $(TEST_OBJS) $(TEST_OUTS)
arcana-lisp: $(MAIN_OBJS)
$(CC) -o $@ $^ $(CFLAGS)
arcana-lisp-test: $(TEST_OBJS)
$(CC) -o $@ $^ $(CFLAGS)
%.c.o: %.c
$(CC) -c $< -o $@ $(CFLAGS)
tests/%.out: tests/%.scm arcana-lisp
$(CAT) $< | ./arcana-lisp > $@