made flags safer
This commit is contained in:
parent
04127bd62a
commit
e88a403c16
31
build.sh
31
build.sh
@ -20,7 +20,8 @@ appOutput="out/why2-app"
|
|||||||
installOutput="libwhy2.so"
|
installOutput="libwhy2.so"
|
||||||
includeDirectory="/usr/include/why2"
|
includeDirectory="/usr/include/why2"
|
||||||
|
|
||||||
flags="-Wall -ljson-c -lcurl"
|
defaultFlags="-Wall"
|
||||||
|
bufferFlags="$defaultFlags"
|
||||||
|
|
||||||
runTest()
|
runTest()
|
||||||
{
|
{
|
||||||
@ -30,18 +31,18 @@ runTest()
|
|||||||
|
|
||||||
# Check for debug flag
|
# Check for debug flag
|
||||||
if [[ "$1" == "debug" ]]; then ########## TEST & DEBUG ##########
|
if [[ "$1" == "debug" ]]; then ########## TEST & DEBUG ##########
|
||||||
flags="$flags -g"
|
bufferFlags="$defaultFlags -g"
|
||||||
echo "Using debug flag"
|
echo "Using debug flag"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
flags="-lwhy2 -Wall"
|
bufferFlags="-lwhy2 $bufferFlags"
|
||||||
|
|
||||||
###
|
###
|
||||||
echo "Compiling... (Flags: $flags)"
|
echo "Compiling... (flags: $bufferFlags)"
|
||||||
###
|
###
|
||||||
|
|
||||||
# Compile
|
# Compile
|
||||||
$compiler $testFile $flags -o $testOutput
|
$compiler $testFile $bufferFlags -o $testOutput
|
||||||
|
|
||||||
# Compilation failed
|
# Compilation failed
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
@ -76,21 +77,21 @@ runInstall()
|
|||||||
echo "Using '$compiler' as default compiler."
|
echo "Using '$compiler' as default compiler."
|
||||||
###
|
###
|
||||||
|
|
||||||
flags="-Wall -fPIC -c"
|
bufferFlags="-fPIC -c $defaultFlags"
|
||||||
|
|
||||||
###
|
###
|
||||||
echo "Compiling... (Flags: $flags)"
|
echo "Compiling... (flags: $bufferFlags)"
|
||||||
###
|
###
|
||||||
|
|
||||||
$compiler $flags $sourceFiles
|
$compiler $bufferFlags $sourceFiles
|
||||||
|
|
||||||
flags="-Wall -shared -ljson-c -lcurl"
|
bufferFlags="$defaultFlags -shared -ljson-c -lcurl "
|
||||||
|
|
||||||
###
|
###
|
||||||
echo "Compiling library... (Flags: $flags)"
|
echo "Compiling library... (flags: $bufferFlags)"
|
||||||
###
|
###
|
||||||
|
|
||||||
$compiler $flags -o $installOutput *.o
|
$compiler $bufferFlags -o $installOutput *.o
|
||||||
|
|
||||||
###
|
###
|
||||||
echo "Installing library..."
|
echo "Installing library..."
|
||||||
@ -123,18 +124,18 @@ runApp()
|
|||||||
|
|
||||||
# Check for debug flag
|
# Check for debug flag
|
||||||
if [[ "$1" == "debug" ]]; then ########## TEST & DEBUG ##########
|
if [[ "$1" == "debug" ]]; then ########## TEST & DEBUG ##########
|
||||||
flags="$flags -g"
|
bufferFlags="$defaultFlags -g"
|
||||||
echo "Using debug flag"
|
echo "Using debug flag"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
flags="-lwhy2 $flags"
|
bufferFlags="-lwhy2 $defaultFlags"
|
||||||
|
|
||||||
###
|
###
|
||||||
echo "Compiling... (Flags: $flags)"
|
echo "Compiling... (flags: $bufferFlags)"
|
||||||
###
|
###
|
||||||
|
|
||||||
# Compile
|
# Compile
|
||||||
$compiler $appFile $flags -o $appOutput
|
$compiler $appFile $bufferFlags -o $appOutput
|
||||||
|
|
||||||
# Compilation failed
|
# Compilation failed
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user