From b4c4074a24eaa03d6f524fe0b2a929a6b0916729 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 15 Oct 2022 14:09:12 +0300 Subject: [PATCH 23/23] winbuild.sh: Clear out old build directory See osdn #45865 Signed-off-by: Marko Lindqvist --- windows/installer_cross/winbuild.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/windows/installer_cross/winbuild.sh b/windows/installer_cross/winbuild.sh index e9c2ea9025..4376780245 100755 --- a/windows/installer_cross/winbuild.sh +++ b/windows/installer_cross/winbuild.sh @@ -98,8 +98,15 @@ if test "x$MAKE_PARAMS" = "x" ; then MAKE_PARAMS="-j$(nproc)" fi -if ! mkdir -p build-${SETUP}${NAMEP} ; then - echo "Can't create build directory \"build-${SETUP}${NAMEP}\"!" >&2 +BUILD_DIR="build-${SETUP}${NAMEP}" + +if ! rm -Rf "${BUILD_DIR}" ; then + echo "Failed to clear out old build directory!" >&2 + exit 1 +fi + +if ! mkdir -p "${BUILD_DIR}" ; then + echo "Can't create build directory \"${BUILD_DIR}\"!" >&2 exit 1 fi @@ -144,7 +151,7 @@ fi INSTALL_DIR="$(pwd)/freeciv-${VERREV}${NAMEP}" if ! ( -cd build-${SETUP}${NAMEP} +cd "${BUILD_DIR}" if test "x$INST_CROSS_MODE" = "xsnapshot" ; then GITREVP="--enable-gitrev" -- 2.35.1