-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (72 loc) · 2.84 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Cudd stuff:
CUDDVER=cudd-3.0.0
CUDDINC=./$(CUDDVER)/include
# CUDDLIBDIR=./$(CUDDVER)/lib
CUDDLIBDIR=
CUDDLIBS=cudd mtr st util
#ifeq ($(CUDDVER),cudd-2.4.1) # for Cudd 2.4.1, add the "epd" library in LIBS
CUDDLIBS += epd
#endif
# Compiler options
TARGET = mql
TARGETDB = dbmql
TARGETDDB = ddbmql
CC = gcc -g -Wall $(CDBG) $(CDDBG) -I$(CUDDINC)
CPP = g++ -g -Wall $(CDBG) $(CDDBG) -I$(CUDDINC)
LINK=g++ -g $(CDBG) $(CDDBG)
# LIBS = -L$(CUDDLIBDIR) \
# -lm $(patsubst %,-l%,$(CUDDLIBS))
CFLAGS = -I $(CUDDVER)/cudd -I $(CUDDVER)/util -I $(CUDDVER)
LFLAGS = -L $(CUDDVER)/cudd/.libs/ -lcudd -lm
O = o
# Modules:
#TMPFILES = irParse.c irLex.c
PARSE = parse
ANALYSE = analyse
IR_MODULES = $(PARSE)/irCon $(PARSE)/irMain $(PARSE)/irName $(PARSE)/irParse $(PARSE)/irPrintx
INT_MODULES = $(PARSE)/intPds $(PARSE)/intExpr $(PARSE)/intBuild $(PARSE)/intSet
ANALYSE_MODULES = $(ANALYSE)/main $(ANALYSE)/preAnalysis $(ANALYSE)/printADD $(ANALYSE)/wrapper
ENTROPY_MODULES = $(ANALYSE)/minEntropy $(ANALYSE)/shannonEntropy
MODULES = $(PARSE)/ident $(PARSE)/hash $(IR_MODULES) $(INT_MODULES) $(ANALYSE_MODULES) $(ENTROPY_MODULES)
OBJECTS = $(MODULES:=.$(O))
# Compiling:
##### Use 'make' or 'make mql' for normal mode; Use 'make dbmql' for debug mode
$(TARGETDDB): CDDBG = -Dddb
$(TARGETDDB): CDBG = -Ddb
$(TARGETDB): CDBG = -Ddb
$(TARGET): $(OBJECTS)
$(LINK) $(OBJECTS) -o $@ $(LIBS) $(LFLAGS)
$(TARGETDB): $(OBJECTS)
$(LINK) $(OBJECTS) -o $@ $(LIBS) $(LFLAGS)
$(TARGETDDB): $(OBJECTS)
$(LINK) $(OBJECTS) -o $@ $(LIBS) $(LFLAGS)
%.$(O): %.c
$(CC) -c -o $@ $< $(CFLAGS)
%.$(O): %.cpp
$(CPP) -c -o $@ $< $(CFLAGS)
# clean
clean:
rm -rf $(TARGET) $(TARGETDB) $(TARGETDDB) \
core core.* *.$(O) *.output mon.out gmon.out out *.d .deps *~ $(ANALYSE)/*.$(O) $(ANALYSE)/*~ \
$(PARSE)/core $(PARSE)/core.* $(PARSE)/*.$(O) $(PARSE)/*.output $(PARSE)/mon.out\
$(PARSE)/gmon.out $(PARSE)/*.d $(PARSE)/*.o $(PARSE)/.deps $(PARSE)/*.dot $(PARSE)/*.pdf $(PARSE)/*~
cclean:
rm -rf $(TARGET) $(TARGETDB) $(TARGETDDB) \
core core.* *.$(O) *.output mon.out gmon.out out *.d .deps *~ $(ANALYSE)/*.$(O) $(ANALYSE)/*~ \
$(PARSE)/core $(PARSE)/core.* $(PARSE)/*.$(O) $(PARSE)/*.output $(PARSE)/mon.out\
$(PARSE)/gmon.out $(PARSE)/*.d $(PARSE)/*.o $(PARSE)/.deps $(PARSE)/*.dot $(PARSE)/*.pdf $(PARSE)/*~\
$(PARSE)/irLex.c $(PARSE)/irParse.c
# Parsers:
$(PARSE)/irParse.$(O): $(PARSE)/irParse.c $(PARSE)/irLex.c
$(PARSE)/irParse.c: $(PARSE)/irParse.y $(PARSE)/irLex.c
bison $(PARSE)/irParse.y -p ir -o $@
$(PARSE)/irLex.c: $(PARSE)/irLex.l
flex -o$@ -Pir $(PARSE)/irLex.l
# Dependencies
%.d: %.c
$(SHELL) -ec '$(CC) -MM $< | sed '\''s,$*.o,& $@,g'\'' > $@'
DEPS = $(OBJECTS:%.$(O)=%.d)
.deps: $(DEPS)
echo " " $(DEPS) | \
sed 's/[ ][ ]*/#include /g' | tr '#' '\012' > .deps
#include .deps