-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
50 lines (36 loc) · 833 Bytes
/
makefile
File metadata and controls
50 lines (36 loc) · 833 Bytes
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
FILENAME=etapa6
SCANNER=lex.yy.c
PARSER=parser.tab.c parser.tab.h parser.output
IDIR=include
CC=gcc
CFLAGS=-I$(IDIR) -g
ODIR=obj
LIBS=
DEPS = $(PARSER) $(SCANNER)
_OBJ = main.o lex.yy.o parser.tab.o ast.o types.o tables.o error.o lex_value.o iloc.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
$(ODIR)/%.o: %.c $(DEPS)
mkdir -p $(ODIR)
$(CC) -c -o $@ $< $(CFLAGS)
all: $(FILENAME)
$(SCANNER): $(PARSER) scanner.l
flex scanner.l
$(PARSER): parser.y
bison -d parser.y
$(FILENAME): $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
entrega: all clean
tar cvzf $(FILENAME).tgz -X .tarignore .
test: all
./$(FILENAME) < tests/teste3.txt > o.s
$(CC) o.s -o programa
./programa
.PHONY: clean
clean:
rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~
rm -f *.tgz
rm -f $(FILENAME)
rm -f $(PARSER)
rm -f $(SCANNER)
rm -f o.s
rm -f programa