Added option to generate header file for yy.lex.c, fixed errors in runner.c, and updated Makefile

This commit is contained in:
Annie
2025-02-12 23:47:12 -05:00
parent 8758763ba0
commit e91eb1815b
4 changed files with 80 additions and 28 deletions

View File

@ -2,15 +2,32 @@ CC := gcc
FLEX := flex
LEX := lexicalStructure.lex
EXE := lexicalStructure
CFLAGS := -std=c99 -Wall
CPPFLAGS :=
lexicalStructure:
$(FLEX) $(LEX)
$(CC) lex.yy.c -o $(EXE)
runner: flex.o runner.o
$(CC) -o runner runner.o flex.o
test_operators:
runner.o: runner.c runner.h flex.h
$(CC) $(CFLAGS) -o runner.o -c runner.c
flex.o: lex.yy.c typedefs.h
$(CC) $(CFLAGS) -o flex.o -c lex.yy.c
lex.yy.c: lexicalStructure.lex
$(FLEX) -o lex.yy.c $(LEX)
test:
./$(EXE) ./tests/test_comments.alpha
./$(EXE) ./tests/test_generalTokenTest.alpha
./$(EXE) ./tests/test_keywords.alpha
./$(EXE) ./tests/test_operators.alpha
./$(EXE) ./tests/test_otherpunc.alpha
./$(EXE) ./tests/test_simpleIntTest.alpha
./$(EXE) ./tests/test_simpleLiterals.alpha
clean:
rm -f *.o
rm -f lex.yy.c
rm -f $(EXE)
rm -f flex.h