-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (47 loc) · 1.54 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
# To hardcode teh version of cl ang
#LLVM_BUILD_PATH :=/afs/cern.ch/sw/lcg/external/llvm/3.7/x86_64-slc6
#LVM_BIN_PATH := $(LLVM_BUILD_PATH)/bin
# To look it up from the binary
CLANGBIN := $(shell which clang++)
LLVM_BIN_PATH := $(shell dirname $(CLANGBIN))
LLVM_BUILD_PATH= $(shell dirname $(LLVM_BIN_PATH))
$(info Using clang from: $(CLANGBIN))
PLUGIN_CXXFLAGS := -fpic
LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags`
LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --ldflags --libs --system-libs`
CLANG_INCLUDES := -I$(LLVM_SRC_PATH)/tools/clang/include -I$(LLVM_BUILD_PATH)/tools/clang/include
CLANG_LIBS := \
-Wl,--start-group \
-lclangAST \
-lclangAnalysis \
-lclangBasic \
-lclangDriver \
-lclangEdit \
-lclangFrontend \
-lclangFrontendTool \
-lclangLex \
-lclangParse \
-lclangSema \
-lclangEdit \
-lclangASTMatchers \
-lclangRewrite \
-lclangRewriteFrontend \
-lclangStaticAnalyzerFrontend \
-lclangStaticAnalyzerCheckers \
-lclangStaticAnalyzerCore \
-lclangSerialization \
-lclangToolingCore \
-lclangTooling \
-Wl,--end-group
CXX := g++
CXXFLAGS:= -fno-rtti -O0 -g
EXEC:= loop_matcher visitor call_matcher
all: $(EXEC)
call_matcher: src/call_matcher.cpp
$(CXX) $(CXXFLAGS) $(LLVM_CXXFLAGS) $(CLANG_INCLUDES) $^ $(CLANG_LIBS) $(LLVM_LDFLAGS) -o $@
loop_matcher: src/loop_matcher.cpp
$(CXX) $(CXXFLAGS) $(LLVM_CXXFLAGS) $(CLANG_INCLUDES) $^ $(CLANG_LIBS) $(LLVM_LDFLAGS) -o $@
visitor: src/visitor.cpp
$(CXX) $(CXXFLAGS) $(LLVM_CXXFLAGS) $(CLANG_INCLUDES) $^ $(CLANG_LIBS) $(LLVM_LDFLAGS) -o $@
clean:
rm -f $(EXEC)