-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·79 lines (65 loc) · 1.92 KB
/
run.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
#!/bin/sh
#
# Edwino Stien - 1201324411
#
# ************** Variaveis globais **************
dirBuild="./build/";
compileTool="./tools/compileOSX.sh";
compileLibTool="./tools/compileTreeLib.sh";
libName="Tree.a";
mainProgramName="main";
compileInvokation="main.cpp Util/Parser.cpp";
params="";
# ************** Programa principal **************
#Cria o diretorio onde ficaram os binarios, caso nao exista
if [ ! -d "$dirBuild" ]; then
echo -n "Criando diretorio \"$dirBuild\"...";
mkdir "$dirBuild";
echo " OK"
fi
# Verifica se a biblioteca já foi compilada
if [ ! -f "$dirBuild$libName" ] ; then
echo
echo -e "\t ######################################################"
echo -e "\t ########## Compilando biblioteca de Árvores ##########"
echo -e "\t ######################################################"
echo
chmod +x "$compileLibTool";
bash -c "$compileLibTool";
if [ $? -ne 0 ]; then
echo
echo " ***** Algo errado ocorreu durante a compilação da biblioteca *****"
exit 1;
fi
echo
fi
#Verifica se o aplicativo já foi compilado
if [ ! -f "$dirBuild$mainProgramName" ] ; then
echo
echo -e "\t ######################################################"
echo -e "\t ################ Compilando Aplicativo ###############"
echo -e "\t ######################################################"
echo
chmod +x "$compileTool";
bash -c "$compileTool $compileInvokation";
if [ $? -ne 0 ]; then
echo
echo " ***** Algo errado ocorreu durante a compilação do aplicativo *****"
exit 1;
fi
echo
fi
echo
echo -e "\t ######################################################"
echo -e "\t ################ Executando Aplicativo ###############"
echo -e "\t ######################################################"
echo
#Pega os parâmetros
for i in `seq 1 $#`
do
eval "params=\"$params \$$i\"";
done;
#Executa o aplicativo
chmod +x "$dirBuild$mainProgramName";
bash -c "$dirBuild$mainProgramName $params";
exit 0;