-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (31 loc) · 865 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
SHELL=/bin/sh
LEX=flex
YACC=bison
CC=gcc
CFLAGS=-g -std=c11 -pedantic -Wall
LDFLAGS=-lfl
# --nounput: ne génère pas la fonction yyunput() inutile
# --DYY_NO_INPUT: ne prend pas en compte la fonction input() inutile
# -D_POSIX_SOURCE: déclare la fonction fileno()
LEXOPTS=-D_POSIX_SOURCE -DYY_NO_INPUT --nounput
YACCOPTS=
EXECS=algo2asm run
all: $(EXECS)
### algo2asm
algo2asm: lex.algo2asm.o algo2asm.tab.o stable.o stack.o
$(CC) $+ -o $@ $(LDFLAGS)
### run
run: lex.run.o run.tab.o stack.o
$(CC) $+ -o $@ $(LDFLAGS)
### others
%.tab.c %.tab.h: %.y lex.%.h
# $(YACC) $(YACCOPTS) $< -d -v
$(YACC) $(YACCOPTS) $< -d -v --graph
lex.%.c: %.l %.tab.h
$(LEX) $(LEXOPTS) -o $@ $<
lex.%.h: %.l
$(LEX) $(LEXOPTS) --header-file=$@ $<
%.o: %.c
$(CC) -DYYDEBUG $(CFLAGS) $< -c
clean:
$(RM) $(EXECS) *.o lex.*.* *.tab.* *.err *.output *.out *.dot *.gv *.asm