summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorFelix Perktold <Felix.Perktold@student.uibk.ac.at>2025-12-21 14:53:26 +0100
committerFelix Perktold <Felix.Perktold@student.uibk.ac.at>2025-12-21 14:53:26 +0100
commit20b1cea7a74a4feb759155eedbb6299bd891a325 (patch)
tree2cf15c07d2284fff2d0d3cbd2fff55ce92345e20 /Makefile
parent4f025b96cfe6bc121ea9b37eb26d8814dd838647 (diff)
add tests
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 19 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 4ff9837..095a7ae 100644
--- a/Makefile
+++ b/Makefile
@@ -3,15 +3,19 @@ YACC = bison
CC = gcc -g
CFLAGS = -DYYDEBUG=1
LIBS = -lreadline -lfl -lm
+OBJS = lisp.o lisp.tab.o lex.yy.o
.SUFFIXES:
-lisp: lisp.c lisp.tab.o lex.yy.o
- $(CC) $(CFLAGS) -o $@ lisp.c lisp.tab.o lex.yy.o $(LIBS)
+main: main.c $(OBJS)
+ $(CC) $(CFLAGS) -o $@ main.c $(OBJS) $(LIBS)
+
+lisp.o: lisp.c lisp.h lex.yy.o
+ $(CC) $(CFLAGS) -c lisp.c
lisp.tab.c lisp.tab.h: lisp.y
$(YACC) -d lisp.y
-lex.yy.c: lisp.l lisp.tab.h
+lex.yy.c lex.yy.h: lisp.l lisp.tab.h
$(LEX) --header-file=lex.yy.h lisp.l
lisp.tab.o: lisp.tab.c
@@ -21,6 +25,16 @@ lex.yy.o: lex.yy.c
$(CC) $(CFLAGS) -c lex.yy.c
clean:
- rm -f *.o lisp 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
+
+test: test.o $(OBJS)
+ $(CC) $(CFLAGS) -o $@ test.o $(OBJS) $(LIBS)
+ ./test
+
+test.o: test.c lisp.h lex.yy.o
+ $(CC) $(CFLAGS) -c test.c
+
+run: main
+ ./main
-.PHONY: clean
+.PHONY: clean test run