-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (43 loc) · 1.08 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
CC=gcc
CFLAGS=-g3 -O0
csn=replace_symbols_elf
util=util
test=TEST
wf=wrapfile
wrapfiles=./wrapfiles/wrapfile
dir_wrapfiles=./wrapfiles
default: ${csn} run
${csn}: ${csn}.o ${util}.o
${CC} ${CFLAGS} $^ -o $@ -lpthread
# For every XYZ.c file, generate XYZ.o.
%.o: %.c
$(CC) $(CFLAGS) $< -c -o $@
run:
rm -f ${test}.o
rm -f ${wrapfiles}1.o ${wrapfiles}2.o ${wrapfiles}3.o
${CC} -c ${test}.c
${CC} -c ${wrapfiles}1.c ${wrapfiles}2.c ${wrapfiles}3.c
# readelf -h ${test}.o
# readelf -S ${test}.o
# readelf -s ${test}.o
#same as --keepnumsymbol=foo_wrap
./${csn} -o ${wf}1.o ${wf}2.o ${wf}3.o -k foo_wrap --keepnumstr=__dmtcp_
#same as
# ./program -o <obj file> --singlesymbol=foo
./${csn} -o ${test}.o -s foo --singlestr=__dmtcp_plt
# readelf -h ${test}.o
# readelf -S ${test}.o
# readelf -s ${test}.o
test:
gcc -c DMTCP.c
# static executable
gcc -static DMTCP.o ${wf}1.o ${wf}2.o ${wf}3.o ${test}.o
# dynamic executable
gcc DMTCP.o ${wf}1.o ${wf}2.o ${wf}3.o ${test}.o -o dyn_a.out
check: test
./a.out
clean:
rm -f ${csn} *.o *a.out
rm -f ${dir_wrapfiles}/*.o
vi:
vim ${csn}.c