Debian Codegraph @

test/pptrace/comparison/instrument/pin/Makefile

raw
1 # Copyright (C) CNRS, INRIA, Université Bordeaux 1, Télécom SudParis
2 # See COPYING in top-level directory.
3
4 BINARIES=my_pin.so my_pin_dummy.so
5
6 LIBINSTRUMENT_SIMPLE_ROOT=$(realpath ../libinstrument-dummy)
7 LIBINSTRUMENT_ROOT=$(realpath ../libinstrument-real)
8
9 PIN_ROOT=$(shell printenv PIN_ROOT)
10 LIBDWARF_DIR=$(shell printenv DWARF_LIBDIR)
11
12 PIN_CFLAGS=-DTARGET_IA32E -DFUND_TC_HOSTCPU=FUND_CPU_INTEL64 -DFUND_TC_TARGETCPU=FUND_CPU_INTEL64 -DTARGET_LINUX -DFUND_TC_HOSTOS=FUND_OS_LINUX -DFUND_TC_TARGETOS=FUND_OS_LINUX \
13 -fpermissive \
14 -I$(PIN_ROOT)/source/InstLib -I$(PIN_ROOT)/extras/xed2-intel64/include -I$(PIN_ROOT)/extras/components/include -I$(PIN_ROOT)/source/include -I$(PIN_ROOT)/source/include/gen
15 LIBINSTRUMENT_CFLAGS=-I$(LIBINSTRUMENT_ROOT)
16 LIBINSTRUMENT_DUMMY_CFLAGS=-I$(LIBINSTRUMENT_SIMPLE_ROOT)
17
18 PIN_LDFLAGS=-Wl,--version-script=$(PIN_ROOT)/source/include/pintool.ver -L../Lib/ -L../ExtLib/ -L$(PIN_ROOT)/extras/xed2-intel64/lib -L$(PIN_ROOT)/intel64/lib -L$(PIN_ROOT)/intel64/lib-ext \
19 -Wl,--rpath,$(PIN_ROOT)/extras/xed2-intel64/lib/ -L$(PIN_ROOT)/extras/xed2-intel64/lib/\
20 -lpin -lxed -lelf -ldl -Wl,--rpath,$(LIBDWARF_DIR) -L$(LIBDWARF_DIR) -ldwarf
21
22 LIBINSTRUMENT_LDFLAGS=-Wl,--rpath,$(LIBINSTRUMENT_ROOT) -L$(LIBINSTRUMENT_ROOT) -linstrument
23 LIBINSTRUMENT_DUMMY_LDFLAGS=-Wl,--rpath,$(LIBINSTRUMENT_SIMPLE_ROOT) -L$(LIBINSTRUMENT_SIMPLE_ROOT) -linstrument
24
25 all: $(BINARIES)
26
27 my_pin.so: my_pin.cpp
28 g++ -shared -o my_pin.so -fPIC my_pin.cpp $(PIN_CFLAGS) $(PIN_LDFLAGS) $(LIBINSTRUMENT_CFLAGS) $(LIBINSTRUMENT_LDFLAGS)
29
30 my_pin_dummy.so: my_pin.cpp
31 g++ -shared -o my_pin_dummy.so -fPIC my_pin.cpp $(PIN_CFLAGS) $(PIN_LDFLAGS) $(LIBINSTRUMENT_DUMMY_CFLAGS) $(LIBINSTRUMENT_DUMMY_LDFLAGS)
32
33 run:
34 @for i in $(TARGETS); do \
35 echo ================================================================================; \
36 echo Running PIN on `basename $$i` for simple instrumentation; \
37 echo ================================================================================; \
38 echo; \
39 $(PIN_ROOT)/pin -t my_pin_dummy.so -- $$i; \
40 echo ================================================================================; \
41 echo Running PIN on `basename $$i` for real instrumentation; \
42 echo ================================================================================; \
43 echo; \
44 $(PIN_ROOT)/pin -t my_pin.so -- $$i; \
45 done
46
47 clean:
48 rm -f *.o $(BINARIES)