-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmakefile
102 lines (79 loc) · 2.41 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
94
95
96
97
98
99
100
101
102
##
## This is a sample makefile for building Pin tools outside
## of the Pin environment. This makefile is suitable for
## building with the Pin kit, not a Pin source development tree.
##
## To build the tool, execute the make command:
##
## make
## or
## make PIN_HOME=<top-level directory where Pin was installed>
##
## After building your tool, you would invoke Pin like this:
##
## $PIN_HOME/pin -t MyPinTool -- /bin/ls
##
##############################################################
#
# User-specific configuration
#
##############################################################
#
# 1. Change PIN_HOME to point to the top-level directory where
# Pin was installed. This can also be set on the command line,
# or as an environment variable.
#
PIN_HOME ?= ../../..
##############################################################
#
# set up and include *.config files
#
##############################################################
PIN_KIT=$(PIN_HOME)
KIT=1
TESTAPP=$(OBJDIR)cp-pin.exe
TARGET_COMPILER?=gnu
ifdef OS
ifeq (${OS},Windows_NT)
TARGET_COMPILER=ms
endif
endif
ifeq ($(TARGET_COMPILER),gnu)
include $(PIN_HOME)/source/tools/makefile.gnu.config
CXXFLAGS ?= -Wall -Werror -Wno-unknown-pragmas $(DBG) $(OPT)
PIN=$(PIN_HOME)/pin
endif
ifeq ($(TARGET_COMPILER),ms)
include $(PIN_HOME)/source/tools/makefile.ms.config
DBG?=
PIN=$(PIN_HOME)/pin.bat
endif
##############################################################
#
# Tools - you may wish to add your tool name to TOOL_ROOTS
#
##############################################################
TOOL_ROOTS = MyPinTool
TOOLS = $(TOOL_ROOTS:%=$(OBJDIR)%$(PINTOOL_SUFFIX))
##############################################################
#
# build rules
#
##############################################################
all: tools
tools: $(OBJDIR) $(TOOLS) $(OBJDIR)cp-pin.exe
test: $(OBJDIR) $(TOOL_ROOTS:%=%.test)
MyPinTool.test: $(OBJDIR)cp-pin.exe
$(MAKE) -k PIN_HOME=$(PIN_HOME)
$(OBJDIR)cp-pin.exe:
$(CXX) $(PIN_HOME)/source/tools/Tests/cp-pin.cpp $(APP_CXXFLAGS) -o $(OBJDIR)cp-pin.exe
$(OBJDIR):
mkdir -p $(OBJDIR)
$(OBJDIR)%.o : %.cpp
$(CXX) -c $(CXXFLAGS) $(PIN_CXXFLAGS) ${OUTOPT}$@ $<
$(TOOLS): $(PIN_LIBNAMES)
$(TOOLS): %$(PINTOOL_SUFFIX) : %.o
${PIN_LD} $(PIN_LDFLAGS) $(LINK_DEBUG) ${LINK_OUT}$@ $< ${PIN_LPATHS} $(PIN_LIBS) $(DBG)
## cleaning
clean:
-rm -rf $(OBJDIR) *.out *.tested *.failed makefile.copy