made adding files easier to makefile

This commit is contained in:
Aaro Koivukangas
2024-08-12 11:14:23 +02:00
parent f38b43774e
commit 67399c071d
+5 -1
View File
@@ -4,6 +4,10 @@ CC_FLAGS=-O2 -Wall -Wextra
SRCDIR=src
INCLUDEDIR=include
FILES=$(SRCDIR)/main.c \
$(SRCDIR)/scanner.c \
$(SRCDIR)/parser.c
scanner:
# this is case insensitive!!
flex -i -o $(SRCDIR)/scanner.c $(SRCDIR)/scanner.flex
@@ -12,4 +16,4 @@ parser:
bison --defines=$(INCLUDEDIR)/token.h --output=$(SRCDIR)/parser.c $(SRCDIR)/parser.bison -Wcounterexamples
all: scanner parser
$(CC) $(CC_FLAGS) -I$(INCLUDEDIR) $(SRCDIR)/main.c $(SRCDIR)/scanner.c $(SRCDIR)/parser.c -o compiler
$(CC) $(CC_FLAGS) -I$(INCLUDEDIR) $(FILES) -o compiler