60 lines
1.5 KiB
Makefile
60 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/arcane.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: arcane-scheme-lisp
|
|
./arcane-scheme-lisp
|
|
|
|
test: arcane-scheme-lisp-test $(TEST_OUTS)
|
|
./arcane-scheme-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/arcane.txt tests/arcane.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) arcane-scheme-lisp arcane-scheme-lisp-test $(MAIN_OBJS) $(TEST_OBJS) $(TEST_OUTS)
|
|
|
|
arcane-scheme-lisp: $(MAIN_OBJS)
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
|
|
|
arcane-scheme-lisp-test: $(TEST_OBJS)
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
|
|
|
%.c.o: %.c
|
|
$(CC) -c $< -o $@ $(CFLAGS)
|
|
|
|
tests/%.out: tests/%.scm arcane-scheme-lisp
|
|
$(CAT) $< | ./arcane-scheme-lisp > $@
|