-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
85 lines (66 loc) · 2.26 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
##
## PIN tools
##
##############################################################
#
# Here are some things you might want to configure
#
##############################################################
TARGET_COMPILER?=gnu
ifdef OS
ifeq (${OS},Windows_NT)
TARGET_COMPILER=ms
endif
endif
##############################################################
#
# include *.config files
#
##############################################################
ifeq ($(TARGET_COMPILER),gnu)
include ../makefile.gnu.config
CXXFLAGS ?= -Wall -Werror -Wno-unknown-pragmas $(DBG) $(OPT)
endif
ifeq ($(TARGET_COMPILER),ms)
include ../makefile.ms.config
DBG?=
endif
##############################################################
#
# build rules
#
##############################################################
TOOL_ROOTS = icache dcache allcache dcache_xscale_config footprint
ifneq ($(TARGET_OS),m)
TOOL_ROOTS += memalloc memalloc2
endif
all: tools
TOOLS = $(TOOL_ROOTS:%=$(OBJDIR)%$(PINTOOL_SUFFIX))
tools: $(OBJDIR) $(TOOLS)
test: $(OBJDIR) $(TOOL_ROOTS:%=%.test)
## build rules
$(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)
##
## In this test the tool does repeated mallocs in it's Fini function until it gets a NULL return value
## It tests that PIN's malloc supplied to the tool correctly returns NULL when out of memory
## A separate test is still needed to get PIN to internally exhaust memory and see that PIN
## outputs the "Out of memory" message to the pin logfile before exiting.
memalloc.test: $(OBJDIR)memalloc$(PINTOOL_SUFFIX) memalloc.tested memalloc.failed
touch memalloc.out; rm memalloc.out
$(PIN) -t $< -o memalloc.out -- $(TESTAPP) makefile $<.makefile.copy
grep -q NULL memalloc.out
rm memalloc.failed memalloc.out
memalloc2.test: $(OBJDIR)memalloc2$(PINTOOL_SUFFIX) memalloc2.tested memalloc2.failed
touch memalloc2.out; rm memalloc2.out
$(PIN) -t $< -o memalloc2.out -- $(TESTAPP) makefile $<.makefile.copy
grep -q OutOfMem memalloc2.out
rm memalloc2.out memalloc2.failed
## cleaning
clean:
-rm -rf $(OBJDIR) *.out *.log *.tested *.failed