-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (32 loc) · 847 Bytes
/
Makefile
File metadata and controls
45 lines (32 loc) · 847 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
CC = gcc
CFLAGS = -Wall -Iinclude -I/opt/homebrew/opt/readline/include
LDFLAGS = -L/opt/homebrew/opt/readline/lib
LDLIBS = -lm -lncurses -lreadline -ldl
FLEX = flex
BISON = bison
EXEC = ippp
SRCS = src/main.c \
src/error_handler.c \
src/hash_table.c \
src/symbol_table.c \
src/functions.c \
src/stack.c
LEX_SRC = src/lex.yy.c
BISON_SRC = src/syn.tab.c
all: $(EXEC)
$(LEX_SRC): src/lex.l
$(FLEX) --header-file=include/lex.yy.h -o $@ $<
$(BISON_SRC): src/syn.y
$(BISON) -d -o $@ --defines=include/syn.tab.h $<
$(EXEC): $(SRCS) $(LEX_SRC) $(BISON_SRC)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
clean:
rm -f \
$(EXEC) \
$(LEX_SRC) \
include/lex.yy.h \
$(BISON_SRC) \
include/syn.tab.h
valgrind: $(EXEC)
valgrind --leak-check=full --show-leak-kinds=all ./$(EXEC)
.PHONY: all clean valgrind