# # Makefile for SPL compiler # CC = gcc CFLAGS = -Wall -pedantic -g -std=c89 LDFLAGS = -g LDLIBS = -lm SRCS = main.c utils.c parser.tab.c lex.yy.c absyn.c symbol.c semant.c table.c types.c varalloc.c codegen.c needs.c OBJS = $(patsubst %.c,%.o,$(SRCS)) BIN = spl .PHONY: all tests depend clean dist-clean all: $(BIN) $(BIN): $(OBJS) $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) %.o: %.c $(CC) $(CFLAGS) -o $@ -c $< parser.tab.c: parser.y bison -dtv parser.y lex.yy.c: scanner.l flex scanner.l tests: all @for i in Tests/test??.spl ; do \ echo ; \ ./$(BIN) $$i ; \ done @echo -include depend.mak depend.mak: parser.tab.c lex.yy.c $(SRCS) $(CC) $(CFLAGS) -MM $(SRCS) > depend.mak clean: rm -f *~ *.o rm -f Tests/*~ dist-clean: clean rm -f $(BIN) parser.tab.c parser.tab.h lex.yy.c depend.mak