-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmk.sh
More file actions
executable file
·83 lines (55 loc) · 2.47 KB
/
mk.sh
File metadata and controls
executable file
·83 lines (55 loc) · 2.47 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
echo "USING CC: [${CC:=gcc}]"
# static library...
echo ":::::::::::::::::::::: Data Provider :::::::::::::::::::::::"
$CC -c -g -I . citeme_provide.c -o citeme_lib.o || exit
strip -x citeme_lib.o || exit
objdump -t citeme_lib.o || exit
nm citeme_lib.o || exit
echo ":::::::::::::::::::::: Static library:::::::::::::::::::::::"
ar rcs citeme_lib.a citeme_lib.o || exit
objdump -t citeme_lib.a || exit
nm citeme_lib.a || exit
echo ":::::::::::::::::::::: Shared library:::::::::::::::::::::::"
# shared library...
$CC -c -g -I . -fPIC citeme_provide.c -o citeme_lib.so.o || exit
$CC -Wl,-x -shared -o citeme_lib.so citeme_lib.so.o || exit
# -Wl,-soname,citeme_lib.so
strip -x citeme_lib.so || exit
objdump -t citeme_lib.so || exit
nm citeme_lib.so || exit
echo ":::::::::::::::::::::: Data Collector :::::::::::::::::::::::"
# main app:
$CC -c -g -I . citeme_collect.c -o citeme_app.o || exit
strip -x citeme_app.o || exit
objdump -t citeme_app.o || exit
nm citeme_app.o || exit
echo ":::::::::::::::::::::: Shared version :::::::::::::::::::::::"
# shared version:
$CC -g citeme_app.o -o citeme_app.dynamically_linked -L. citeme_lib.so || exit
strip -x citeme_app.dynamically_linked || exit
objdump -t citeme_app.dynamically_linked || exit
nm citeme_app.dynamically_linked || exit
echo "Running......................................................"
## run shared version...
# echo $LD_LIBRARY_PATH
LD_LIBRARY_PATH=. ./citeme_app.dynamically_linked
echo "......................................................ret: $?"
echo ":::::::::::::::::::::: Static version :::::::::::::::::::::::"
# static version
$CC -g -L. citeme_app.o -o citeme_app citeme_lib.a || exit
strip -x citeme_app || exit
objdump -t citeme_app || exit
nm citeme_app || exit
echo "Running......................................................"
./citeme_app
echo "......................................................ret: $?"
echo ":::::::::::::::::::::: Totally Static version (gcc only?) :::::::::::::::::::::::"
$CC -g -L. -static citeme_app.o -o citeme_app.statically_linked citeme_lib.a || exit
strip -x citeme_app.statically_linked || exit
######### TOOOOOOOOOOO MUCH SYMBOLS.....
objdump -t citeme_app.statically_linked | grep RegisterCitation || exit
nm citeme_app.statically_linked | grep RegisterCitation || exit
echo "Running......................................................"
./citeme_app.statically_linked
echo "......................................................ret: $?"