edit build script

This commit is contained in:
Quinn
2024-11-17 23:59:42 +01:00
parent 8352eda527
commit db0dd2e0fa

View File

@@ -35,23 +35,23 @@ args_emscripten()
if [ "$1" = "linux86_64" ]; then args_linux86_64
elif [ "$1" = "win86_64" ]; then args_win86-64
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
# check whether $BUILD_DIR or $ARCHITECTURE isn't set
if [[ -z $BUILD_DIR ]] || [[ -z "$ARCHITECTURE" ]]; then
echo -e "\033[91mBUILD_DIR or ARCHITECTURE not set D:\033[0m"
exit -1
exit 1
fi
# make (and clear) the build directory
mkdir $BUILD_DIR $BUILD_DIR/$ARCHITECTURE
rm -rf $BUILD_DIR/$ARCHITECTURE/*
mkdir "$BUILD_DIR $BUILD_DIR/$ARCHITECTURE"
rm -rf "${BUILD_DIR:?}/$ARCHITECTURE/*"
# copy included files or directories to the build directory
if [[ ! -z $INCLUDE_IN_BUILD ]]; then
cp -r $INCLUDE_IN_BUILD $BUILD_DIR/$ARCHITECTURE
if [[ -n $INCLUDE_IN_BUILD ]]; then
cp -r "$INCLUDE_IN_BUILD" "$BUILD_DIR/$ARCHITECTURE"
fi
# get the executable path
@@ -59,13 +59,13 @@ EXE_PATH=$BUILD_DIR/$ARCHITECTURE/$PROJECT_NAME$FILE_EXSTENSION
echo "building at: $EXE_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"
exit -1
exit 1
fi
# 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"
$COMMAND
exit $?