# 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 -Wall 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 -g3 -Wall 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 -g3 -Wall parser_test.o symbol_map.o expr.o scanner.o parser.o -o parser_test.out -lm scanner_test: scanner_test.o symbol_map.o expr.o scanner.o parser.o gcc -g3 -Wall scanner_test.o symbol_map.o expr.o scanner.o parser.o -o scanner_test.out -lm run_parser_test: parser_test ./parser_test.out run_interpreter_test: test ./interpreter_test.out run_scanner_test: scanner_test ./scanner_test.out run_tests: run_parser_test run_interpreter_test run_scanner_test # 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 parser_test.out scanner_test.out