cobol-interpreter-lab/lab-5/Makefile

33 lines
1.1 KiB
Makefile

# The top level rule indicates how to link everything together into main
main: main.o symbol_map.o expr.o scanner.o parser.o
gcc -g3 main.o symbol_map.o expr.o scanner.o parser.o -o interpreter.out -lm
test: main_test.o symbol_map.o expr.o scanner.o parser.o
gcc main_test.o symbol_map.o expr.o scanner.o parser.o -o interpreter_test.out -lm
parser_test: parser_test.o symbol_map.o expr.o scanner.o parser.o
gcc parser_test.o symbol_map.o expr.o scanner.o parser.o -o parser_test.out -lm
# This pattern indicates that any .o file depends
# upon the .c file of the same name, and all of the .h files.
# So, if a .o file is needed, it is built automatically.
%.o: %.c *.h
gcc -g3 -Wall -c $< -o $@
# Only the files generated by flex and bison need explicit rules.
scanner.c: scanner.flex parser.h
flex -oscanner.c scanner.flex
parser.c parser.h: parser.bison
bison --defines=parser.h --output=parser.c -v parser.bison
# clean causes all intermediate files to be deleted.
clean:
rm -f parser.c parser.output parser.h scanner.c *.o interpreter.out interpreter_test.out test_evaluate.txt test_print.txt