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 |
#!/bin/bash
DIR=/mnt/user/bin
PROG=$DIR/robot-debug
rm -rf $DIR
mkdir -p $DIR
if [ "$1" == "/mnt/usercode/robot.c" ]; then
CODEDIR="usb_stick_cached"
rm -rf /mnt/user/code/${CODEDIR%%/*} >/dev/null
mkdir -p /mnt/user/code/${CODEDIR%%/*} >/dev/null
echo "Compiling ${1} for debug"
/mnt/user/nhs/gcc-usercode-debug "${1}" -o /mnt/user/code/${CODEDIR%%/*}/robot-debug 2>&1
if [ -e /mnt/user/code/${CODEDIR%%/*}/robot-debug ]; then
echo "Compile for debug succeeded."
else
echo "Compiling ${1}pp for debug"
/mnt/user/nhs/g++-usercode-debug "${1}pp" -o /mnt/user/code/${CODEDIR%%/*}/robot-debug 2>&1
if [ -e /mnt/user/code/${CODEDIR%%/*}/robot-debug ]; then
echo "Compile for debug succeeded."
else
echo "Compiling ${1}xx for debug"
/mnt/user/nhs/g++-usercode-debug "${1}xx" -o /mnt/user/code/${CODEDIR%%/*}/robot-debug 2>&1
if [ -e /mnt/user/code/${CODEDIR%%/*}/robot-debug ]; then
echo "Compile for debug succeeded."
else
echo "Compile for debug failed."
fi
fi
fi
else
case ${1} in
*/mnt/user/code/*) CODEDIR=${1#*/mnt/user/code/} ; echo "Checking directory ${CODEDIR%%/*} for binary" ;;
esac
if [ ! -e /mnt/user/code/${CODEDIR%%/*}/robot-debug ]; then
echo "Compiling ${1} for debug"
/mnt/user/nhs/gcc-usercode-debug "${1}" -o /mnt/user/code/${CODEDIR%%/*}/robot-debug 2>&1
if [ -e /mnt/user/code/${CODEDIR%%/*}/robot-debug ]; then
echo "Compile for debug succeeded."
else
echo "Compiling ${1}pp for debug"
/mnt/user/nhs/g++-usercode-debug "${1}pp" -o /mnt/user/code/${CODEDIR%%/*}/robot-debug 2>&1
if [ -e /mnt/user/code/${CODEDIR%%/*}/robot-debug ]; then
echo "Compile for debug succeeded."
else
echo "Compiling ${1}xx for debug"
/mnt/user/nhs/g++-usercode-debug "${1}xx" -o /mnt/user/code/${CODEDIR%%/*}/robot-debug 2>&1
if [ -e /mnt/user/code/${CODEDIR%%/*}/robot-debug ]; then
echo "Compile for debug succeeded."
else
echo "Compile for debug failed."
fi
fi
fi
fi
fi
echo "Copying /mnt/user/code/${CODEDIR%%/*}/robot-debug to $PROG"
cp /mnt/user/code/${CODEDIR%%/*}/robot-debug $PROG
if [ -e $PROG ]; then
echo "Copy succeeded."
else
echo "Copy failed."
fi |