separated build.sh into functions

uhm, yeah - the file was kinda shitty so..
This commit is contained in:
Václav Šmejkal 2022-05-12 17:23:06 +02:00
parent f61b5f0b95
commit b098af3ebf

View File

@ -22,7 +22,8 @@ includeDirectory="/usr/include/why2"
flags="-Wall -ljson-c -lcurl" flags="-Wall -ljson-c -lcurl"
if [[ "$1" == "test" ]]; then ########## TEST ########## function runTest()
{
### ###
echo "Using '$compiler' as default compiler." echo "Using '$compiler' as default compiler."
### ###
@ -51,7 +52,10 @@ if [[ "$1" == "test" ]]; then ########## TEST ##########
### ###
echo "Output generated as '$testOutput'" echo "Output generated as '$testOutput'"
### ###
elif [[ "$1" == "install" ]]; then ########## INSTALL ########## }
function runInstall()
{
### ###
echo "Installing header files..." echo "Installing header files..."
### ###
@ -104,7 +108,7 @@ elif [[ "$1" == "install" ]]; then ########## INSTALL ##########
echo "Compiling why2-app..." echo "Compiling why2-app..."
### ###
./build.sh app runApp
### ###
echo "Installing why2-app..." echo "Installing why2-app..."
@ -117,7 +121,10 @@ elif [[ "$1" == "install" ]]; then ########## INSTALL ##########
### ###
rm -rf *.o rm -rf *.o
elif [[ "$1" == "app" ]]; then ########## BUILD APP ########## }
function runApp()
{
### ###
echo "Using '$compiler' as default compiler." echo "Using '$compiler' as default compiler."
### ###
@ -146,10 +153,18 @@ elif [[ "$1" == "app" ]]; then ########## BUILD APP ##########
### ###
echo "Output generated as '$appOutput'" echo "Output generated as '$appOutput'"
### ###
}
if [[ "$1" == "test" ]]; then ########## TEST ##########
runTest
elif [[ "$1" == "install" ]]; then ########## INSTALL ##########
runInstall
elif [[ "$1" == "app" ]]; then ########## BUILD APP ##########
runApp
else ########## ELSE ########## else ########## ELSE ##########
if [[ "$1" == "installTest" ]]; then ########## INSTALL & TEST ########## if [[ "$1" == "installTest" ]]; then ########## INSTALL & TEST ##########
./build.sh install runInstall
./build.sh test runTest
else ########## ERR ########## else ########## ERR ##########
### ###
echo "You have to enter 'install', 'test' or 'app' as arguments. (Or 'installTest' for install & test)" echo "You have to enter 'install', 'test' or 'app' as arguments. (Or 'installTest' for install & test)"