#Makefile for the term project of the MIT SIPB Crash Course in C, IAP 1999.
#Copyright (c) 1998 by Matthew Belmonte.

CC = cc
FLAGS = -g
LDFLAGS = 
OBJS = scanner.o parser.o evaluator.o

evaluator: scanner.o parser.o evaluator.o
	$(CC) $(FLAGS) -o evaluator scanner.o parser.o evaluator.o $(LDFLAGS)

scanner.o: scanner.c scanner.h
	$(CC) $(FLAGS) -c scanner.c

parser.o: parser.c parser.h scanner.h
	$(CC) $(FLAGS) -c parser.c

evaluator.o: evaluator.c parser.h
	$(CC) $(FLAGS) -c evaluator.c

clean:
	rm -f $(OBJS) evaluator testscan.o testscan testparse.o testparse

testscan: testscan.o scanner.o
	$(CC) $(FLAGS) -o testscan testscan.o scanner.o $(LDFLAGS)

testscan.o: testscan.c
	$(CC) $(FLAGS) -c testscan.c

testparse: testparse.o parser.o scanner.o
	$(CC) $(FLAGS) -o testparse testparse.o parser.o scanner.o

testparse.o: testparse.c
	$(CC) $(CFLAGS) -c testparse.c
