-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
54 lines (41 loc) · 1.29 KB
/
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
53
54
######################################################################
# Compiladors
# Cristòfol Daudén Esmel
# Makefile
######################################################################
# General defines
CC = gcc
LEX = flex
YACC = bison
LIB = -lc -lfl -lm
ELEX = LexicalAnalyzer.l
SRCL = LexicalAnalyzer.c
EYACC = SyntacticAnalyzer.y
SRCY = SyntacticAnalyzer.c
OBJ = LexicalAnalyzer.o SyntacticAnalyzer.o compiler.o
SRC = compiler.c symtab/symtab.c operations.c ThreeAddressCode.c
BIN = compiler
LFLAGS = -n -o $*.c
YFLAGS = -d -v -o $*.c
CFLAGS = -ansi -Wall -g
OTHERS = SyntacticAnalyzer.output SyntacticAnalyzer.h ./output/* ./output
######################################################################
all : $(SRCL) $(SRCY)
$(CC) -o $(BIN) $(CFLAGS) $(SRCL) $(SRCY) $(SRC) $(LIB)
$(SRCL) : $(ELEX)
$(LEX) $(LFLAGS) $<
$(SRCY) : $(EYACC)
$(YACC) $(YFLAGS) $<
clean :
rm -rf $(BIN) $(OBJ) $(SRCL) $(SRCY) $(OTHERS)
run : clean all
mkdir output
for filename in ./input/*.txt; do \
file=$$(basename $$filename); \
echo "\nRunning "$$filename; \
./$(BIN) ./input/$$file ./output/$$file; \
done
test: clean all
mkdir output
./$(BIN) ./input/program.txt ./output/program.out;
more ./output/program.out