-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile.rules
71 lines (58 loc) · 2.89 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
# In this file we define which of our own applications/tools/test should be built.
# For docs see: http://software.intel.com/sites/landingpage/pintool/docs/62141/Pin/html/index.html#AddingTests
# For a complex example see: pin/source/tools/SimpleExamples/makefile.rules
# DataTracker top dir
DTRACKER_ROOT = $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
# Paths for support libraries.
SUPPORT_REL_PATH = ./support
SUPPORT_PATH = $(realpath $(SUPPORT_REL_PATH))
LIBDFT_PATH = $(realpath $(SUPPORT_PATH)/libdft/src)
LIBDFT_TAG_FLAGS ?= -DLIBDFT_TAG_TYPE=libdft_tag_set_fdoff
#LIBDFT_TAG_FLAGS ?= -DLIBDFT_TAG_TYPE=libdft_tag_bitset -DTAG_BITSET_SIZE=32
# Turns pintool.log output off.
LOGGING_FLAGS = -DNO_PINTOOL_LOG
# Pin Makefile variables.
TOOL_ROOTS := dtracker
APP_ROOTS :=
TEST_ROOTS :=
TOOL_CXXFLAGS += -std=c++11 $(LOGGING_FLAGS) $(LIBDFT_TAG_FLAGS) -I$(DTRACKER_ROOT) -I$(LIBDFT_PATH)
#######################################################################
# Data Tracker.
#######################################################################
DTRACKER_HOOKS_ACTIVE = $(shell echo "LIBDFT_TAG_TYPE" | $(CPP) $(LIBDFT_TAG_FLAGS) - | tail -1)
DTRACKER_HOOKS_DIR = hooks/$(DTRACKER_HOOKS_ACTIVE)
DTRACKER_HOOKS_SRC = $(wildcard $(DTRACKER_HOOKS_DIR)/*.cpp)
DTRACKER_HOOKS_OBJS = $(patsubst %.cpp,$(OBJDIR)%$(OBJ_SUFFIX),$(DTRACKER_HOOKS_SRC))
DTRACKER_OBJS = $(OBJDIR)dtracker$(OBJ_SUFFIX)\
$(DTRACKER_HOOKS_OBJS)\
$(OBJDIR)provlog$(OBJ_SUFFIX)\
$(OBJDIR)osutils$(OBJ_SUFFIX)\
$(OBJDIR)dtracker_debug$(OBJ_SUFFIX)
$(OBJDIR)dtracker$(OBJ_SUFFIX): dtracker.cpp | $(OBJDIR)hooks/$(DTRACKER_HOOKS_ACTIVE)
$(CXX) $(TOOL_CXXFLAGS) $(COMP_OBJ)$@ $<
# Note: $(TOOL_LIBS) must come after -ldft, or you'll get undefined symbols at runtime.
$(OBJDIR)dtracker$(PINTOOL_SUFFIX): $(DTRACKER_OBJS)
$(LINKER) $(TOOL_LDFLAGS) $(LINK_EXE)$@ $(^:%.h=) $(TOOL_LPATHS) -L$(LIBDFT_PATH) -ldft $(TOOL_LIBS)
#######################################################################
# Directories.
#######################################################################
$(OBJDIR)%:
mkdir -p $@
#######################################################################
# Generic rules for support libraries.
#######################################################################
SUPPORT_VARS += CC="$(CC)" CFLAGS="$(TOOL_CFLAGS)"
SUPPORT_VARS += CXX="$(CXX)" CXXFLAGS="$(TOOL_CXXFLAGS)"
.PHONY: support-%
support-%:
LIBDFT_TAG_FLAGS="$(LIBDFT_TAG_FLAGS)" $(MAKE) -C support -f makefile.$*
.PHONY: help
help:
$(info Some potentially useful targets:)
$(info - support : Builds libraries to be used for writing/compiling pin tools.)
$(info - support-clean : Remove the built libraries.)
$(info )
$(info Some potentially useful options:)
$(info - DEBUG=1 : Turns off optimizations and enables debug flags.)
$(info - USE_GLIB=1 : Enable compile/linking flags for glib.)
# vim: set noet ts=4 sts=4 sw=4 ai ft=make :