1
0
Fork 0
lesson-lisp/Makefile

45 lines
864 B
Makefile

all: test
CAT = cat
CC = gcc
DIFF_Q = diff -q
RM_F = rm -f
CFLAGS = -Wall -Wextra
TEST_SCM = test.scm
TEST_EXP = test.txt
TEST_OUT = test.out
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
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 arcane-scheme-lisp-test
./arcane-scheme-lisp-test
$(CAT) $(TEST_SCM) | ./arcane-scheme-lisp > $(TEST_OUT)
$(DIFF_Q) $(TEST_EXP) $(TEST_OUT)
clean:
$(RM_F) arcane-scheme-lisp arcane-scheme-lisp-test $(MAIN_OBJS) $(TEST_OBJS) $(TEST_OUT)
arcane-scheme-lisp: $(MAIN_OBJS)
$(CC) -o $@ $^ $(CFLAGS)
arcane-scheme-lisp-test: $(TEST_OBJS)
$(CC) -o $@ $^ $(CFLAGS)
%.c.o: %.c
$(CC) -c $< -o $@ $(CFLAGS)