-
Notifications
You must be signed in to change notification settings - Fork 0
/
compileandlink.sh
90 lines (75 loc) · 1.16 KB
/
compileandlink.sh
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
84
85
86
87
88
89
90
#/bin/bash
if [ $# -eq 1 -o $# -eq 2 ]
then
if [ $1 = "c" ]
then
echo "Cleaning ..."
rm -rf log.txt DinaBOTSlave.nxj DinaBOTMaster.nxj bin/ html/
exit 0
fi
echo "Setup ..."
if [ -f log.txt ]
then
rm log.txt
fi
if ! mkdir bin
then
exit 1
fi
if ! cd bin
then
exit 1
fi
echo "Build and Link ..."
if [ $1 = "m" ]
then
if ! nxjc ../dinaBOT/DinaBOTMaster.java -d ./ -sourcepath ../
then
cd ..
rm -rf bin
exit 1
fi
if ! nxjlink dinaBOT/DinaBOTMaster -cp ./ -o ../DinaBOTMaster.nxj -v > ../log.txt
then
cd ..
rm -rf bin
exit 1
fi
cd ..
if [ $# -eq 2 ]
then
if [ $2 = "f" ]
then
echo "Flashing ..."
nxjupload DinaBOTMaster.nxj -u
fi
fi
fi
if [ $1 = "s" ]
then
if ! nxjc ../dinaBOT/DinaBOTSlave.java -d ./ -sourcepath ../
then
cd ..
rm -rf bin
exit 1
fi
if ! nxjlink dinaBOT/DinaBOTSlave -cp ./ -o ../DinaBOTSlave.nxj -v > ../log.txt
then
cd ..
rm -rf bin
exit 1
fi
cd ..
if [ $# -eq 2 ]
then
if [ $2 = "f" ]
then
echo "Flashing ..."
nxjupload DinaBOTSlave.nxj -u
fi
fi
fi
rm -rf bin
exit 0
fi
exit 1