Skip to content

Commit

Permalink
pt: Adapt Makefile to build from multiple sources
Browse files Browse the repository at this point in the history
  • Loading branch information
aewag committed Mar 2, 2023
1 parent 4bb9d33 commit 794e32c
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pintool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@
# Project Name
PROJ := DATA - Pintool

# Pintool Name
TEST_TOOL_ROOTS := addrtrace

#------------------------------------------------------------------------
# Targets
#------------------------------------------------------------------------
.PHONY: all clean clean2 i386 x86_64 32 64

all: i386 x86_64 32 64
all: x86_64 64

# Pin Root
ifneq ($(MAKECMDGOALS),help)
Expand All @@ -44,6 +41,7 @@ ifneq ($(MAKECMDGOALS),clean)
endif
CONFIG_ROOT := $(PIN_ROOT)/source/tools/Config
include $(CONFIG_ROOT)/makefile.config
include makefile.rules
include $(TOOLS_ROOT)/Config/makefile.default.rules
endif
endif
Expand Down
88 changes: 88 additions & 0 deletions pintool/makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
##############################################################
#
# 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 := addrtrace

# 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 the static analysis tools which will be run during the the tests. They should not
# be defined in TEST_TOOL_ROOTS. If a test with the same name exists, it should be defined in
# TEST_ROOTS.
# Note: Static analysis tools are in fact executables linked with the Pin Static Analysis Library.
# This library provides a subset of the Pin APIs which allows the tool to perform static analysis
# of an application or dll. Pin itself is not used when this tool runs.
SA_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 OS-specific definitions here ######

# I am not aware that we require any OS-specific definitions.

###### 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


##############################################################
#
# 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.

$(OBJDIR)call-stack$(OBJ_SUFFIX): call-stack.cpp call-stack.H
$(CXX) $(TOOL_CXXFLAGS) $(SUPPRESS_WARNING_ALIGNED_NEW) $(COMP_OBJ)$@ $<

$(OBJDIR)sha1$(OBJ_SUFFIX): sha1.cpp sha1.hpp
$(CXX) $(TOOL_CXXFLAGS) $(COMP_OBJ)$@ $<

# Build the tool as a dll (shared object).
$(OBJDIR)addrtrace$(PINTOOL_SUFFIX): $(OBJDIR)call-stack$(OBJ_SUFFIX) $(OBJDIR)sha1$(OBJ_SUFFIX) $(OBJDIR)addrtrace$(OBJ_SUFFIX)
$(LINKER) $(TOOL_LDFLAGS) $(LINK_EXE)$@ $(^:%.h=) $(TOOL_LPATHS) $(TOOL_LIBS)

0 comments on commit 794e32c

Please sign in to comment.