source: liacs/coco/assignment2/Makefile@ 153

Last change on this file since 153 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.6 KB
Line 
1#
2# Makefile for assignment 2 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#
22# If you want to add another C/C++ file to the compiler, add the name of the
23# corresponding .o file to the OBJFILES macro below:
24#
25OBJFILES = debug.o messages.o coercion.o lookup.o
26OBJDIR = gen/
27OBJS = $(addprefix $(OBJDIR),$(OBJFILES))
28
29# Precompiled object files
30POBJFILES = types.o SyntaxTree.o Node.o Symbol.o SymbolTable.o Scope.o
31POBJDIR = obj/
32POBJS = $(addprefix $(POBJDIR),$(POBJFILES))
33
34IMPORTANT = comp.[hly] *.h *.c *.cc \
35 Makefile
36
37.PHONY: all first clean backup dirs showdeps
38
39all: comp
40
41# To be executed before the very first build
42first: dirs
43
44# Dependency stuff
45comp: $(OBJDIR)y.tab.o $(OBJDIR)lex.yy.o $(OBJS) $(POBJS)
46 $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBS)
47
48$(OBJDIR)y.tab.h $(OBJDIR)y.tab.c: comp.y
49 $(YACC) $(YFLAGS) $< -o $(OBJDIR)y.tab.c
50
51$(OBJDIR)lex.yy.c: comp.l
52 $(LEX) $(LFLAGS) -o$@ $<
53
54clean:
55 rm -f $(OBJDIR){lex.yy.c,y.tab.*,y.output,*.o} *~ comp \
56 `find . -name core -o -name \*\.bak`
57
58backup:
59 tar cfz ../CoCo-`date +'%y%m%d-%H%M'`.tar.gz $(IMPORTANT)
60
61dirs:
62 mkdir gen
63
64# Show dependencies between .c files
65showdeps:
66 $(CC) -MM *.c *.cc
67
68# Dependency stuff
69$(OBJDIR)lex.yy.o: $(OBJDIR)lex.yy.c $(OBJDIR)y.tab.h
70$(OBJDIR)y.tab.o: $(OBJDIR)y.tab.c
71
72$(OBJDIR)%.o: %.c
73 $(CC) $(CFLAGS) -c -o $@ $<
74
75$(OBJDIR)%.o: %.cc
76 $(CC) $(CFLAGS) -c -o $@ $<
Note: See TracBrowser for help on using the repository browser.