-
Notifications
You must be signed in to change notification settings - Fork 22
/
exrun
executable file
·66 lines (64 loc) · 1.36 KB
/
exrun
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
#!/bin/sh
if [ -z "$1" ]
then
echo "usage: $0 [TOOL] <example> [args...]"
echo
echo " Runs the given example, using the library in the current directory"
echo " instead of using the system library search mechanism. Accepts an "
echo " arbitrary number of arguments."
echo
echo " TOOL can be 'valgrind', 'gdb', or 'ldd', which causes exrun to"
echo " run the example program under the given tool."
echo
exit 1
fi
TOOL=
PROG=$1
if [ "$PROG" = 'valgrind' ]
then
TOOL='valgrind'
shift
PROG=$1
elif [ "$PROG" = 'gdb' ]
then
TOOL='gdb --args'
shift
PROG=$1
elif [ "$PROG" = 'ldd' ]
then
TOOL='ldd'
shift
PROG=$1
fi
shift
if [ -e "$PROG" ]
then
if [ `uname -s` = 'Darwin' ]
then
DYLD_LIBRARY_PATH=. $TOOL ./$PROG $*
elif [ `uname -o` = 'Cygwin' ]
then
# Cygwin build case; see below for bash-as-DOS-shell case
PATH=. $TOOL ./$PROG $*
elif [ -e /usr/bin/ldd ]
then
if [ `uname -s` = 'SunOS' ]
then
LD_LIBRARY_PATH=.:/usr/mysql/lib/mysql $TOOL ./$PROG $*
else
LD_LIBRARY_PATH=. $TOOL ./$PROG $*
fi
else
echo "ERROR: I don't grok this system's dynamic linkage system."
fi
elif [ `uname -o` = 'Cygwin' ]
then
# VC++ build, but using Cygwin's bash as shell to run programs
cmd.exe /c exrun.bat $PROG $*
else
echo "usage: $0 [TOOL] <example> [args...]"
echo
echo " Run $0 without arguments for more detailed usage info."
echo
exit 1
fi