mirror of
https://github.com/thepigeongenerator/breakout_clone.git
synced 2025-12-16 22:05:45 +01:00
edit build script
This commit is contained in:
18
build.sh
18
build.sh
@@ -35,23 +35,23 @@ args_emscripten()
|
|||||||
if [ "$1" = "linux86_64" ]; then args_linux86_64
|
if [ "$1" = "linux86_64" ]; then args_linux86_64
|
||||||
elif [ "$1" = "win86_64" ]; then args_win86-64
|
elif [ "$1" = "win86_64" ]; then args_win86-64
|
||||||
elif [ "$1" = "web" ]; then args_emscripten
|
elif [ "$1" = "web" ]; then args_emscripten
|
||||||
else echo -e "\033[91mdidn't include any arguments! D:\033[0m" && exit -1
|
else echo -e "\033[91mdidn't include any arguments! D:\033[0m" && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check whether $BUILD_DIR or $ARCHITECTURE isn't set
|
# check whether $BUILD_DIR or $ARCHITECTURE isn't set
|
||||||
if [[ -z $BUILD_DIR ]] || [[ -z "$ARCHITECTURE" ]]; then
|
if [[ -z $BUILD_DIR ]] || [[ -z "$ARCHITECTURE" ]]; then
|
||||||
echo -e "\033[91mBUILD_DIR or ARCHITECTURE not set D:\033[0m"
|
echo -e "\033[91mBUILD_DIR or ARCHITECTURE not set D:\033[0m"
|
||||||
exit -1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# make (and clear) the build directory
|
# make (and clear) the build directory
|
||||||
mkdir $BUILD_DIR $BUILD_DIR/$ARCHITECTURE
|
mkdir "$BUILD_DIR $BUILD_DIR/$ARCHITECTURE"
|
||||||
rm -rf $BUILD_DIR/$ARCHITECTURE/*
|
rm -rf "${BUILD_DIR:?}/$ARCHITECTURE/*"
|
||||||
|
|
||||||
# copy included files or directories to the build directory
|
# copy included files or directories to the build directory
|
||||||
if [[ ! -z $INCLUDE_IN_BUILD ]]; then
|
if [[ -n $INCLUDE_IN_BUILD ]]; then
|
||||||
cp -r $INCLUDE_IN_BUILD $BUILD_DIR/$ARCHITECTURE
|
cp -r "$INCLUDE_IN_BUILD" "$BUILD_DIR/$ARCHITECTURE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get the executable path
|
# get the executable path
|
||||||
@@ -59,13 +59,13 @@ EXE_PATH=$BUILD_DIR/$ARCHITECTURE/$PROJECT_NAME$FILE_EXSTENSION
|
|||||||
echo "building at: $EXE_PATH"
|
echo "building at: $EXE_PATH"
|
||||||
|
|
||||||
# check whether the compiler path contains an executable at said path
|
# check whether the compiler path contains an executable at said path
|
||||||
if [ ! -x $COMPILER ]; then
|
if [ ! -x "$COMPILER" ]; then
|
||||||
echo -e "\033[91mCouldn't find an executable at path: \033[0m $COMPILER"
|
echo -e "\033[91mCouldn't find an executable at path: \033[0m $COMPILER"
|
||||||
exit -1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# compile the code
|
# compile the code
|
||||||
COMMAND="$COMPILER `find ./src -name *.c` -o $EXE_PATH -Wall -g -lm $ARGS"
|
COMMAND="$COMPILER $(find ./src -name "*.c") -o $EXE_PATH -Wall -g -lm $ARGS"
|
||||||
echo "using command: $COMMAND"
|
echo "using command: $COMMAND"
|
||||||
$COMMAND
|
$COMMAND
|
||||||
exit $?
|
exit $?
|
||||||
|
|||||||
Reference in New Issue
Block a user