diff --git a/etc/bashrc b/etc/bashrc index ae19940a4e..5f5d9d9878 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -113,10 +113,30 @@ foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \ export WM_PROJECT_INST_DIR=$FOAM_INST_DIR export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION +if [ -d "$WM_PROJECT_DIR" ] +then + WM_PROJECT_DIR_REAL=$(cd $WM_PROJECT_DIR && pwd -P) + if [ -d "$WM_PROJECT_DIR_REAL" -a -e "$WM_PROJECT_DIR_REAL/etc/bashrc" ] + then + export WM_PROJECT_DIR=$WM_PROJECT_DIR_REAL + fi + unset WM_PROJECT_DIR_REAL +fi + # Location of third-party software # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION +if [ -d "$WM_THIRD_PARTY_DIR" ] +then + WM_THIRD_PARTY_DIR_REAL=$(cd $WM_THIRD_PARTY_DIR && pwd -P) + if [ -d "$WM_THIRD_PARTY_DIR_REAL" -a -e "$WM_THIRD_PARTY_DIR_REAL/etc/tools" ] + then + export WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR_REAL + fi + unset WM_THIRD_PARTY_DIR_REAL +fi + # Location of site-specific templates etc # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # unset is equivalent to $WM_PROJECT_INST_DIR/site diff --git a/wmake/wclean b/wmake/wclean index 8ccd637dc4..3c3d80df8d 100755 --- a/wmake/wclean +++ b/wmake/wclean @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -260,10 +260,11 @@ unset targetType if [ -d "$MakeDir" ] then objectsDir=$MakeDir/$WM_OPTIONS - if [[ "$PWD" = *"$WM_PROJECT_DIR"* ]] + expandPath "$PWD" + if [[ "$exPath" = *"$WM_PROJECT_DIR"* ]] then platformPath=$WM_PROJECT_DIR/platforms/${WM_OPTIONS} - objectsDir=$platformPath${PWD//$WM_PROJECT_DIR/} + objectsDir=$platformPath${exPath//$WM_PROJECT_DIR/} fi rm -rf "$objectsDir" 2>/dev/null fi diff --git a/wmake/wrmdep b/wmake/wrmdep index 1999b25edb..2cb138acc4 100755 --- a/wmake/wrmdep +++ b/wmake/wrmdep @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -227,12 +227,16 @@ oldFolders) updateMode) - if [ "$PWD" != "$WM_PROJECT_DIR" ] + expandPath "$PWD" + if [ "$exPath" != "$WM_PROJECT_DIR" ] then echo "Cannot 'update', not in the project top-level directory" exit 1 fi + # Go into the real path + cd "$exPath" + echo "Removing dep files corresponding to source files that no longer exist..." fileNameList=$(find -L src applications -name '*.[CHL]' -type l)