cobol-interpreter-lab/lab-4/Makefile

30 lines
826 B
Makefile

# The top level rule indicates how to link everything together into main
main: main.o scanner.o parser.o
gcc main.o scanner.o parser.o -o parser.out -lm
test: main_test.o scanner.o parser.o
gcc main_test.o scanner.o parser.o -o parser_test.out -lm
# 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=token.h --output=parser.c -v parser.bison
# 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 -Wall -c $< -o $@
# clean causes all intermediate files to be deleted.
clean:
rm -f parser.c parser.output token.h scanner.c *.o parser.out parser_test.out