############################################################## # # Here are some things you might want to configure # ############################################################## #TARGET_COMPILER?=ms TARGET_COMPILER?=gnu ############################################################## # # include *.config files # ############################################################## ifeq ($(TARGET_COMPILER),gnu) include ../makefile.gnu.config LINKER?=${CXX} endif ifeq ($(TARGET_COMPILER),ms) include ../makefile.ms.config endif ifeq ($(TARGET_OS),w) # This test appears to hang on Win32 and Win64. See Mantis bug #613 for details. # Uncomment these lines when the bug is fixed. # #ifeq ($(TARGET),ia32) # APPS = hello # TOOLS = segtrace # TESTS = trace_hello #endif #ifeq ($(TARGET),ia32e) # APPS = hello # TOOLS = segtrace # TESTS = trace_hello #endif else ifeq ($(TARGET),ia32) APPS = thread TOOLS = segtrace TESTS = trace_thread endif ifeq ($(TARGET),ia32e) APPS = thread TOOLS = segtrace TESTS = trace_thread endif endif all: $(APPS) $(TOOLS:=$(PINTOOL_SUFFIX)) test: $(TESTS:=.test) tests-sanity: test # # Rules to build the applications # thread: thread.c $(CC) $(OUTOPT)$@ $@.c -lpthread hello: hello.c $(CC) $(OUTOPT)$@ $@.c # # Rules to build the tools # $(TOOLS:=.o) : %.o : %.cpp $(CXX) $(COPT) $(CXXFLAGS) $(PIN_CXXFLAGS) $(OUTOPT)$@ $< $(TOOLS:=$(PINTOOL_SUFFIX)): $(PIN_LIBNAMES) $(TOOLS:=$(PINTOOL_SUFFIX)): %$(PINTOOL_SUFFIX) : %.o $(LINKER) $(PIN_LDFLAGS) $(LINK_DEBUG) $(LINK_OUT)$@ $< $(PIN_LPATHS) $(PIN_LIBS) $(DBG) # # Rules to run the tests. # trace_thread.test: trace_thread.tested trace_thread.failed segtrace$(PINTOOL_SUFFIX) thread $(PIN) -mt -t segtrace$(PINTOOL_SUFFIX) -- ./thread rm $(@:.test=.failed) trace_hello.test: trace_hello.tested trace_hello.failed segtrace$(PINTOOL_SUFFIX) hello $(PIN) -mt -t segtrace$(PINTOOL_SUFFIX) -- ./hello rm $(@:.test=.failed) clean: rm -f $(APPS) $(TOOLS:=$(PINTOOL_SUFFIX)) $(TOOLS:=.o) $(TESTS:=.tested) $(TESTS:=.failed) segtrace.out