-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (38 loc) · 762 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
CC=gcc
l=flex
yy=bison
CFLAGS=-Werror -lfl -g
SFLAGS=-no-pie -g
o=compiler
lx=lexer
team=15
assignment=5
testfile=testthing.nc
fname=$(team)_A$(assignment)
build: $(o)
test: build
./runtests.sh
$(o): $(fname)_translator.o $(fname).tab.o $(lx).o compiler.o
$(CC) -o $@ $^ $(CFLAGS)
$(lx): lexmain.o $(lx).o
$(CC) -o $@ $^
$(fname).tab.c: $(fname).y
$(yy) -d $^ -t
$(lx).c: $(fname).l $(fname).tab.c
$(l) -o$@ $<
%.o: %.c
$(CC) -c $^ $(CFLAGS)
testexec: build
./$(o) test 0 < compilertest.nc
gcc -c test.s $(SFLAGS)
gcc -o testexec test.o $(SFLAGS)
clean:
rm -rf $(o)
rm -rf $(o).exe
rm -rf $(lx)*
rm -rf *.o
rm -rf $(fname).tab.*
rm -rf *.out
rm -rf *.asm
rm -rf test.s test.o test.out testexec
.PHONY: default clean build lex test