-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
65 lines (49 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
55
56
57
58
59
60
61
62
63
64
65
CC?= gcc
RM?= rm -f
BISON?= bison
FLEX?= flex
INSTALL?=install
DESTDIR?=/usr/local/bin
MAJ_VER=0
MIN_VER=18
WARNFLAGS= -Wsystem-headers -Wall -W -Wno-unused-parameter \
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
-Wold-style-definition -Wreturn-type -Wwrite-strings \
-Wswitch -Wshadow -Wcast-align -Wchar-subscripts \
-Winline -Wnested-externs \
-Wno-error -Wno-implicit-function-declaration
#WARNFLAGS+= -Werror -Wcast-qual -Wunused-parameter
VER_FLAGS= -DMAJ_VER=$(MAJ_VER) -DMIN_VER=$(MIN_VER)
CFLAGS= $(WARNFLAGS) $(VER_FLAGS) -std=c99 -D_BSD_SOURCE `pkg-config gmp mpfr --cflags`
CFLAGS_DEBUG= -O0 -g3
CFLAGS_OPT= -O4 -flto
LDFLAGS=
LIBS= -lm `pkg-config gmp mpfr --libs`
ifeq (${DEBUG}, yes)
CFLAGS += $(CFLAGS_DEBUG)
else
CFLAGS += $(CFLAGS_OPT)
endif
OBJS= calc.tab.o lex.yy.o
OBJS+= linenoise.o
OBJS+= num.o ast.o var.o func.o hashtable.o safe_mem.o main.o
all: asccalc
asccalc: $(OBJS)
$(CC) $(CFLAGS) -o asccalc $^ $(LIBS)
calc.tab.c: calc.y lex.yy.h
$(BISON) -d $<
calc.tab.h: calc.tab.c
# created by dep
lex.yy.c: calc.l
$(FLEX) --header-file=lex.yy.h $<
lex.yy.h: lex.yy.c
# created by dep
clean:
$(RM) $(OBJS)
$(RM) asccalc
realclean: clean
$(RM) calc.tab.c calc.tab.h
$(RM) lex.yy.c lex.yy.h
$(RM) *~
install: asccalc
$(INSTALL) asccalc $(DESTDIR)