-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (25 loc) · 695 Bytes
/
Makefile
File metadata and controls
34 lines (25 loc) · 695 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
all: clangtool.so
CXX=clang++
CC=clang
LLVM_CONFIG=llvm-config
# Flags for building shared libraries.
SYSTEM=$(shell uname)
ifeq ($(SYSTEM), Darwin)
CXXFLAGS= -fno-common
LDFLAGS= -dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress
endif
ifeq ($(SYSTEM), Linux)
CXXFLAGS= -fPIC
LDFLAGS= -shared
endif
clangtool.so : %.so: %.cpp
$(CXX) $(CXXFLAGS) $< -o $@ `$(LLVM_CONFIG) --cxxflags` $(LDFLAGS)
CLANGTOOL_FLAGS=-Xclang -load -Xclang ./clangtool.so
.PHONY: test testO0 testO2
test: testO0 testO2
testO0: test.c clangtool.so
$(CC) $(CLANGTOOL_FLAGS) -O0 -o test test.c
testO2: test.c clangtool.so
$(CC) $(CLANGTOOL_FLAGS) -O2 -o test test.c
clean:
rm -f clangtool.so test