diff --git a/wmake/scripts/wmakeFunctions b/wmake/scripts/wmakeFunctions index 72322448f63772febcdff76aac0e71a678e078ce..89134c835a45f257b91d2d1bf75f4d8cc4827060 100644 --- a/wmake/scripts/wmakeFunctions +++ b/wmake/scripts/wmakeFunctions @@ -173,13 +173,18 @@ findObjectDir() # Default (local) build directory if [ -z "$objectsDir" ] then - relativeDir="$absdir" - appDir=. - [ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal - absdir=$(expandPath "$appDir"/.) + if [ -d "$absdir/Make" ] + then + objectsDir="${absdir}/Make/${WM_OPTIONS}" + else + relativeDir="$absdir" + appDir=. + [ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal + absdir=$(expandPath "$appDir"/.) - relativeDir="${relativeDir#${absdir}}" - objectsDir="${appDir}/Make/${WM_OPTIONS}${relativeDir}" + relativeDir="${relativeDir#${absdir}}" + objectsDir="${appDir}/Make/${WM_OPTIONS}${relativeDir}" + fi fi echo "$objectsDir" diff --git a/wmake/wclean b/wmake/wclean index 53712bfadd2ab2177afdb769609bead2bd5f25fa..ca2fe7f81c05a840f5f670c778b7a3d808fec7fb 100755 --- a/wmake/wclean +++ b/wmake/wclean @@ -313,16 +313,18 @@ fi # Clean the 'Make' directory if present #------------------------------------------------------------------------------ -if [ -d "$MakeDir" ] +if [ -d "$MakeDir" ] && [ -n "$WM_OPTIONS" ] then - objectsDir="$MakeDir/$WM_OPTIONS" - case "$PWD" in - ("$WM_PROJECT_DIR"/*) - buildPath="$WM_PROJECT_DIR/build/${WM_OPTIONS}" - objectsDir=$buildPath$(echo $PWD | sed s%$WM_PROJECT_DIR%% ) - ;; - esac - rm -rf "$objectsDir" 2>/dev/null + # Remove in-source directory (if any) + rm -rf "$MakeDir/$WM_OPTIONS" 2>/dev/null + + # Remove out-of-source directory (if applicable) + relativeDir="${PWD#${WM_PROJECT_DIR}/}" + if [ "$relativeDir" != "$PWD" ] + then + objectsDir="${WM_PROJECT_DIR}/build/${WM_OPTIONS}/${relativeDir}" + rm -rf "$objectsDir" 2>/dev/null + fi fi #------------------------------------------------------------------------------