-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_tool
More file actions
54 lines (41 loc) · 1.51 KB
/
make_tool
File metadata and controls
54 lines (41 loc) · 1.51 KB
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
include commons.mk
SOURCEDIR = src
COMMONDIR = $(SOURCEDIR)/common
TOOLDIR = $(SOURCEDIR)/tool
BUILDDIR = build
SOURCES := $(shell find $(COMMONDIR) $(TOOLDIR) -name '*.cpp' -not -path '*/tool.cpp')
OBJECTS := $(addprefix $(BUILDDIR)/,$(subst $(SOURCEDIR)/,,$(SOURCES:%.cpp=%.o)))
INC = -I$(COMMONDIR) \
-I$(TOOLDIR) \
-I$(SOURCEDIR) \
-I$(PIN_ROOT)/source/include/pin \
-I$(PIN_ROOT)/source/include/pin/gen \
-I$(PIN_ROOT)/extras/components/include \
-I$(PIN_ROOT)/extras/xed2-intel64/include \
-I$(PIN_ROOT)/source/tools/InstLib \
CFLAGS += -O3 -DTARGET_IA32E -DHOST_IA32E -fPIC -DTARGET_LINUX -g
CFLAGS += $(INC)
CFLAGS += -std=c++11
CFLAGS += -MMD -MP
LIBS = -L$(PIN_ROOT)/extras/xed2-intel64/lib \
-L$(PIN_ROOT)/intel64/lib \
-L$(PIN_ROOT)/intel64/lib-ext \
-L$(PIN_ROOT)/intel64/runtime/glibc \
-lpin -lxed -ldwarf -lelf -ldl
LDFLAGS = -g \
$(LIBS) \
-Wl,--hash-style=sysv \
-Wl,-Bsymbolic \
-Wl,--version-script=$(PIN_ROOT)/source/include/pin/pintool.ver
TOOL_CFLAGS = $(CFLAGS)
TOOL_CFLAGS += -fomit-frame-pointer -DBIGARRAY_MULTIPLIER=1 \
-Wall -Werror -Wno-unknown-pragmas -fno-stack-protector
$(BUILDDIR)/%.o: $(SOURCEDIR)/%.cpp
mkdir -p $(dir $@)
g++ -std=c++11 -c $< -o $@ $(CFLAGS)
$(BUILDDIR)/tool/%.so: $(SOURCEDIR)/tool/%.cpp $(OBJECTS)
g++ -shared -o $@ $^ $(TOOL_CFLAGS) $(LDFLAGS)
all: $(BUILDDIR)/tool/tool.so
-include $(OBJECTS:%.o=%.d)
# not delete object files
.SECONDARY: $(OBJECTS)