-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile.rules
191 lines (149 loc) · 7.78 KB
/
makefile.rules
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
##############################################################
#
# This file includes all the test targets as well as all the
# non-default build rules and test recipes.
#
##############################################################
##############################################################
#
# Test targets
#
##############################################################
###### Place all generic definitions here ######
# This defines tests which run tools of the same name. This is simply for convenience to avoid
# defining the test name twice (once in TOOL_ROOTS and again in TEST_ROOTS).
# Tests defined here should not be defined in TOOL_ROOTS and TEST_ROOTS.
TEST_TOOL_ROOTS := proj1
# This defines the tests to be run that were not already defined in TEST_TOOL_ROOTS.
TEST_ROOTS :=
# This defines the tools which will be run during the the tests, and were not already defined in
# TEST_TOOL_ROOTS.
TOOL_ROOTS :=
# This defines all the applications that will be run during the tests.
APP_ROOTS :=
# This defines any additional object files that need to be compiled.
OBJECT_ROOTS :=
# This defines any additional dlls (shared objects), other than the pintools, that need to be compiled.
DLL_ROOTS :=
# This defines any static libraries (archives), that need to be built.
LIB_ROOTS :=
###### Place architecture-specific definitions here ######
# Place ia32-specific definitions here if they apply to all supported operating systems.
ifeq ($(TARGET),ia32)
TEST_TOOL_ROOTS +=
endif
# Place intel64-specific definitions here if they apply to all supported operating systems.
ifeq ($(TARGET),intel64)
TEST_TOOL_ROOTS +=
endif
###### Place OS-specific definitions here ######
# Linux
ifeq ($(TARGET_OS),linux)
TEST_ROOTS +=
APP_ROOTS +=
ifeq ($(TARGET),intel64)
TEST_TOOL_ROOTS +=
endif
endif
# Mac OS X*
ifeq ($(TARGET_OS),mac)
ifeq ($(TARGET),intel64)
TEST_TOOL_ROOTS +=
endif
endif
###### Handle exceptions here ######
# topopcode can't be compiled on 64b Windows
ifeq ($(TARGET_OS),windows)
ifeq ($(TARGET),intel64)
TEST_TOOL_ROOTS := $(filter-out topopcode, $(TEST_TOOL_ROOTS))
endif
endif
###### Define the sanity subset ######
# This defines the list of tests that should run in sanity. It should include all the tests listed in
# TEST_TOOL_ROOTS and TEST_ROOTS excluding only unstable tests.
SANITY_SUBSET := $(TEST_TOOL_ROOTS) $(TEST_ROOTS)
##############################################################
#
# Test recipes
#
##############################################################
# This section contains recipes for tests other than the default.
# See makefile.default.rules for the default test rules.
# All tests in this section should adhere to the naming convention: <testname>.test
# -dwarf_file is not supported on Windows.
ifeq ($(TARGET_OS),windows)
DWARF_FILE_KNOB :=
else
ifeq ($(TARGET_OS),mac)
GET_SOURCE_DEBUG_FILE := get_source_app$(EXE_SUFFIX):$(OBJDIR)get_source_app$(EXE_SUFFIX).dSYM/Contents/Resources/DWARF/get_source_app$(EXE_SUFFIX)
else
GET_SOURCE_DEBUG_FILE := get_source_app$(EXE_SUFFIX):$(OBJDIR)get_source_app$(EXE_SUFFIX)
endif
DWARF_FILE_KNOB := -dwarf_file $(GET_SOURCE_DEBUG_FILE)
endif
get_source_location.test: $(OBJDIR)get_source_location$(PINTOOL_SUFFIX) $(OBJDIR)get_source_app$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)get_source_location$(PINTOOL_SUFFIX) $(DWARF_FILE_KNOB) \
-- $(OBJDIR)get_source_app$(EXE_SUFFIX) > $(OBJDIR)get_source_location.out 2>&1
$(QGREP) "get_source_app.cpp:3" $(OBJDIR)get_source_location.out
$(QGREP) "get_source_app.cpp:4" $(OBJDIR)get_source_location.out
$(QGREP) "get_source_app.cpp:5" $(OBJDIR)get_source_location.out
$(RM) $(OBJDIR)get_source_location.out
get_source_location_gnu_debug.test: $(OBJDIR)get_source_location$(PINTOOL_SUFFIX) $(OBJDIR)get_source_app_gnu_debug$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)get_source_location$(PINTOOL_SUFFIX) \
-- $(OBJDIR)get_source_app_gnu_debug$(EXE_SUFFIX) > $(OBJDIR)get_source_location_gnu_debug.out 2>&1
$(QGREP) "get_source_app.cpp:3" $(OBJDIR)get_source_location_gnu_debug.out
$(QGREP) "get_source_app.cpp:4" $(OBJDIR)get_source_location_gnu_debug.out
$(QGREP) "get_source_app.cpp:5" $(OBJDIR)get_source_location_gnu_debug.out
$(RM) $(OBJDIR)get_source_location_gnu_debug.out
regval.test: $(OBJDIR)regval$(PINTOOL_SUFFIX) $(OBJDIR)regval_app$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)regval$(PINTOOL_SUFFIX) -o $(OBJDIR)regval.out -- $(OBJDIR)regval_app$(EXE_SUFFIX)
$(RM) $(OBJDIR)regval.out
oper-imm.test: $(OBJDIR)oper-imm$(PINTOOL_SUFFIX) $(OBJDIR)oper_imm_app$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)oper-imm$(PINTOOL_SUFFIX) -o $(OBJDIR)oper-imm.out -- $(OBJDIR)oper_imm_app$(EXE_SUFFIX)
$(DIFF) $(OBJDIR)oper-imm.out oper-imm.$(TARGET).reference
$(RM) $(OBJDIR)oper-imm.out
bsr_bsf.test: $(OBJDIR)bsr_bsf$(PINTOOL_SUFFIX) $(OBJDIR)bsr_bsf_app$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)bsr_bsf$(PINTOOL_SUFFIX) -o $(OBJDIR)bsr_bsf.out -- $(OBJDIR)bsr_bsf_app$(EXE_SUFFIX)
$(DIFF) $(OBJDIR)bsr_bsf.out bsr_bsf.reference
$(RM) $(OBJDIR)bsr_bsf.out
inscount_and_check_tls.test: $(OBJDIR)inscount_and_check_tls$(PINTOOL_SUFFIX) $(THREAD_APP)
$(PIN) -t $(OBJDIR)inscount_and_check_tls$(PINTOOL_SUFFIX) -- $(THREAD_APP) > $(OBJDIR)inscount_and_check_tls.out 2>&1
$(RM) $(OBJDIR)inscount_and_check_tls.out
##############################################################
#
# Build rules
#
##############################################################
# This section contains the build rules for all binaries that have special build rules.
# See makefile.default.rules for the default build rules.
###### Special tools' build rules ######
$(OBJDIR)opcodemix$(PINTOOL_SUFFIX): $(OBJDIR)opcodemix$(OBJ_SUFFIX) $(CONTROLLERLIB)
$(LINKER) $(TOOL_LDFLAGS) $(LINK_EXE)$@ $^ $(TOOL_LPATHS) $(TOOL_LIBS)
$(OBJDIR)regval$(PINTOOL_SUFFIX): $(OBJDIR)regval$(OBJ_SUFFIX) $(REGVALLIB)
$(LINKER) $(TOOL_LDFLAGS) $(LINK_EXE)$@ $^ $(TOOL_LPATHS) $(TOOL_LIBS)
###### Special applications' build rules ######
$(OBJDIR)get_source_app$(EXE_SUFFIX): get_source_app.cpp
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(DBG_INFO_CXX_ALWAYS) $(COMP_EXE)$@ $< $(APP_LDFLAGS_NOOPT) $(APP_LIBS) \
$(CXX_LPATHS) $(CXX_LIBS) $(DBG_INFO_LD_ALWAYS)
$(OBJDIR)get_source_app_gnu_debug$(EXE_SUFFIX): $(OBJDIR)get_source_app$(EXE_SUFFIX)
$(CP) $(OBJDIR)get_source_app$(EXE_SUFFIX) $(OBJDIR)get_source_app_gnu_debug$(EXE_SUFFIX)
$(OBJCOPY) --only-keep-debug $(OBJDIR)get_source_app_gnu_debug$(EXE_SUFFIX) $(OBJDIR)get_source_app_gnu_debug.dbg
$(OBJCOPY) --strip-debug $(OBJDIR)get_source_app_gnu_debug$(EXE_SUFFIX)
$(OBJCOPY) --add-gnu-debuglink=$(OBJDIR)get_source_app_gnu_debug.dbg $(OBJDIR)get_source_app_gnu_debug$(EXE_SUFFIX)
# This application needs to be compiled without optimizations for the placeholder functions to be available to the tool.
$(OBJDIR)regval_app$(EXE_SUFFIX): regval_app.cpp
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $< $(APP_LDFLAGS_NOOPT) $(APP_LIBS) $(CXX_LPATHS) $(CXX_LIBS)
ifeq ($(TARGET_OS),windows)
$(OBJDIR)oper_imm_app$(EXE_SUFFIX): oper_imm_app.cpp $(OBJDIR)oper_imm_asm$(OBJ_SUFFIX)
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $^ $(APP_LDFLAGS_NOOPT) /EXPORT:operImmCmds $(APP_LIBS) $(CXX_LPATHS) $(CXX_LIBS)
else
$(OBJDIR)oper_imm_app$(EXE_SUFFIX): oper_imm_app.cpp $(OBJDIR)oper_imm_asm$(OBJ_SUFFIX)
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $^ $(APP_LDFLAGS_NOOPT) $(APP_LIBS) $(CXX_LPATHS) $(CXX_LIBS)
endif
ifeq ($(TARGET_OS),windows)
$(OBJDIR)bsr_bsf_app$(EXE_SUFFIX): bsr_bsf_app.cpp $(OBJDIR)bsr_bsf_asm$(OBJ_SUFFIX)
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $^ $(APP_LDFLAGS_NOOPT) /EXPORT:bsr_func /EXPORT:bsf_func $(APP_LIBS) $(CXX_LPATHS) $(CXX_LIBS)
else
$(OBJDIR)bsr_bsf_app$(EXE_SUFFIX): bsr_bsf_app.cpp $(OBJDIR)bsr_bsf_asm$(OBJ_SUFFIX)
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $^ $(APP_LDFLAGS_NOOPT) $(APP_LIBS) $(CXX_LPATHS) $(CXX_LIBS)
endif