82 lines
1.6 KiB
Makefile
82 lines
1.6 KiB
Makefile
CC := gcc
|
|
FLEX := flex
|
|
LEX := src/lexicalStructure.lex
|
|
EXE := alpha
|
|
CFLAGS :=
|
|
YACC := bison
|
|
|
|
TESTS-S1 := $(wildcard tests/sprint1/test/*.alpha)
|
|
TESTS-S2 := $(wildcard tests/sprint2/test/*.alpha)
|
|
TESTS-S3 := $(wildcard tests/sprint3/test/*.alpha)
|
|
TESTS-S4 := $(wildcard tests/sprint4/test/*.alpha)
|
|
|
|
compiler: clean runner
|
|
|
|
tmp/grammar.tab.c: src/grammar.y
|
|
mkdir -p tmp
|
|
$(YACC) -d src/grammar.y
|
|
mv grammar.tab.c tmp/
|
|
mv grammar.tab.h tmp/
|
|
|
|
tmp/lex.yy.c: src/lexicalStructure.lex tmp/grammar.tab.c
|
|
$(FLEX) -o tmp/lex.yy.c $(LEX)
|
|
mv flex.h tmp/
|
|
|
|
tmp/runner.o: src/runner.c src/runner.h tmp/flex.h
|
|
$(CC) $(CFLAGS) -o tmp/runner.o -c src/runner.c
|
|
|
|
tmp/symbol_table.o: src/symbol_table.c src/symbol_table.h
|
|
$(CC) $(CFLAGS) -o tmp/symbol_table.o -c src/symbol_table.c
|
|
|
|
runner: tmp/lex.yy.c tmp/runner.o tmp/symbol_table.o
|
|
$(CC) $(CFLAGS) -o $(EXE) tmp/runner.o tmp/grammar.tab.c tmp/lex.yy.c
|
|
|
|
debug: CFLAGS += -DDEBUG=1
|
|
debug: clean compiler
|
|
|
|
test:
|
|
chmod +x ./check.sh
|
|
chmod +x ./test.sh
|
|
$(foreach test, $(TESTS-S1), (./$(EXE) -tok -debug $(test) || true);)
|
|
./test.sh sp2
|
|
./test.sh sp3
|
|
./test.sh sp4
|
|
./check.sh
|
|
|
|
test-s1:
|
|
chmod +x ./check.sh
|
|
chmod +x ./test.sh
|
|
$(foreach test, $(TESTS-S1), (./$(EXE) -tok -debug $(test) || true);)
|
|
./check.sh sp1
|
|
|
|
test-s2:
|
|
chmod +x ./check.sh
|
|
chmod +x ./test.sh
|
|
./test.sh sp2
|
|
./check.sh sp2
|
|
|
|
test-s3:
|
|
chmod +x ./check.sh
|
|
chmod +x ./test.sh
|
|
./test.sh sp3
|
|
./check.sh sp3
|
|
|
|
test-s4:
|
|
chmod +x ./check.sh
|
|
chmod +x ./test.sh
|
|
./test.sh sp4
|
|
./check.sh sp4
|
|
|
|
clean:
|
|
rm -f *.o
|
|
rm -f lex.yy.c
|
|
rm -f $(EXE)
|
|
rm -f flex.h
|
|
rm -f *.tok
|
|
rm -f grammar.tab.c
|
|
rm -f grammar.tab.h
|
|
rm -f *.st
|
|
rm -rf out
|
|
rm -rf tmp
|
|
rm -f parser
|