source: liacs/coco/assignment4/Makefile@ 2

Last change on this file since 2 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 1.7 KB
Line 
1#
2# Makefile for assignment 4 (and 5) of the Compiler Construction course.
3# Fall 2007, LIACS, Leiden University.
4#
5
6CC = g++
7LEX = flex
8YACC = bison --yacc
9
10WARNINGS = -Wall -ansi
11OTHERS = -m32 -g
12DEFINES = -DDEBUG
13IDIRS = -I.
14
15CFLAGS = $(WARNINGS) $(OTHERS) $(DEFINES) $(IDIRS)
16LFLAGS =
17YFLAGS = --defines --debug --verbose
18LDFLAGS = -m32 -g
19LOADLIBS = -lfl -lm
20
21# If you want to add another C/C++ file to the compiler, add the name of the
22# corresponding .o file to the OBJFILES macro below:
23OBJFILES = debug.o main.o ICGenerator.o \
24 StackFrameManager.o CodeGenerator.o MStatement.o MOperand.o \
25 MOperator.o AssemblerCode.o StackFrameManager.o CodeGenerator.o \
26 RegisterManager.o
27OBJDIR = gen/
28OBJS = $(addprefix $(OBJDIR),$(OBJFILES))
29
30# Precompiled object files
31POBJFILES = types.o SyntaxTree.o Node.o Symbol.o SymbolTable.o Scope.o \
32 IntermediateCode.o IStatement.o IOperand.o IOperator.o \
33 ICGenerator0.o
34POBJDIR = obj/
35POBJS = $(addprefix $(POBJDIR),$(POBJFILES))
36
37IMPORTANT = comp.[hly] *.h *.c *.cc \
38 Makefile
39
40.PHONY: all first clean backup dirs showdeps
41
42all: comp
43
44# To be executed before the very first build
45first: dirs
46
47# Dependency stuff
48comp: $(POBJDIR)y.tab.o $(POBJDIR)lex.yy.o $(OBJS) $(POBJS)
49 $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBS)
50
51clean:
52 rm -f $(OBJDIR)*.o comp \
53 `find . -name core -o -name \*\.bak`
54
55backup:
56 tar cfz ../CoCo-`date +'%y%m%d-%H%M'`.tar.gz $(IMPORTANT)
57
58dirs:
59 mkdir gen
60
61# Show dependencies between .c files
62showdeps:
63 $(CC) -MM *.c *.cc
64
65# Dependency stuff
66$(OBJDIR)%.o: %.c
67 $(CC) $(CFLAGS) -c -o $@ $<
68
69$(OBJDIR)%.o: %.cc
70 $(CC) $(CFLAGS) -c -o $@ $<
71
72bt: all
73 gdb -x gdb.script ./comp
Note: See TracBrowser for help on using the repository browser.