# # Makefile for assignment 3 of the Compiler Construction course. # Fall 2008, LIACS, Leiden University. # CC = g++ LEX = flex YACC = bison --yacc WARNINGS = -Wall -ansi OTHERS = -m32 -g DEFINES = -DDEBUG IDIRS = -I. CFLAGS = $(WARNINGS) $(OTHERS) $(DEFINES) $(IDIRS) LFLAGS = YFLAGS = --defines --debug --verbose LDFLAGS = -m32 -g LOADLIBS = -lfl -lm # If you want to add another C/C++ file to the compiler, add the name of the # corresponding .o file to the OBJFILES macro below: OBJFILES = debug.o main.o ICGenerator.o OBJDIR = gen/ OBJS = $(addprefix $(OBJDIR),$(OBJFILES)) # Precompiled object files POBJFILES = types.o SyntaxTree.o Node.o Symbol.o SymbolTable.o Scope.o \ IntermediateCode.o IStatement.o IOperand.o IOperator.o POBJDIR = obj/ POBJS = $(addprefix $(POBJDIR),$(POBJFILES)) IMPORTANT = comp.[hly] *.h *.c *.cc \ Makefile .PHONY: all first clean backup dirs showdeps all: comp # To be executed before the very first build first: dirs # Dependency stuff comp: $(POBJDIR)y.tab.o $(POBJDIR)lex.yy.o $(OBJS) $(POBJS) $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBS) clean: rm -f $(OBJDIR)*.o comp \ `find . -name core -o -name \*\.bak` backup: tar cfz ../CoCo-`date +'%y%m%d-%H%M'`.tar.gz $(IMPORTANT) dirs: mkdir gen # Show dependencies between .c files showdeps: $(CC) -MM *.c *.cc # Dependency stuff $(OBJDIR)%.o: %.c $(CC) $(CFLAGS) -c -o $@ $< $(OBJDIR)%.o: %.cc $(CC) $(CFLAGS) -c -o $@ $<