From db8febe9f9dc1cbe2794dcfec5e95ef62655fa8e Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Wed, 4 Mar 2009 13:14:11 +0100
Subject: [PATCH] wmakeLnInclude -f now also changes the default linking to 'ln
 -sf'

- this seems to be the most sensible solution.
  The changed time stamps on the links doesn't seem to bother make at all.
---
 src/Allwmake                      |  4 ++--
 src/turbulenceModels/LES/Allwmake |  2 +-
 wmake/wmakeLnInclude              | 38 ++++++++++++++++++-------------
 3 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/src/Allwmake b/src/Allwmake
index c3ce648ba0a..f22e0729dbe 100755
--- a/src/Allwmake
+++ b/src/Allwmake
@@ -5,8 +5,8 @@ set -x
 # update OpenFOAM version strings if required
 wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
 
-wmakeLnInclude -f OpenFOAM -sf
-wmakeLnInclude -f OSspecific/$WM_OS -sf
+wmakeLnInclude -f OpenFOAM
+wmakeLnInclude -f OSspecific/$WM_OS
 Pstream/Allwmake
 
 wmake libo  OSspecific/$WM_OS
diff --git a/src/turbulenceModels/LES/Allwmake b/src/turbulenceModels/LES/Allwmake
index d83439a9130..a80c71ab57d 100755
--- a/src/turbulenceModels/LES/Allwmake
+++ b/src/turbulenceModels/LES/Allwmake
@@ -2,7 +2,7 @@
 cd ${0%/*} || exit 1    # run from this directory
 set -x
 
-wmakeLnInclude -f ../incompressible/LES -sf
+wmakeLnInclude -f ../incompressible/LES
 
 wmake libso LESfilters
 wmake libso LESdeltas
diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude
index 1ed1671e7a3..c85ebd08a19 100755
--- a/wmake/wmakeLnInclude
+++ b/wmake/wmakeLnInclude
@@ -47,10 +47,13 @@ usage() {
 usage: $Script [-f] <dir> [-lnOption]
 
     Link all the source files in the <dir> into <dir>/lnInclude
-    * Use '-f' to force an update when the lnInclude directory already exists.
+
+Note
+    The '-f' option forces an update when the lnInclude directory already exists
+    and also changes the default linking from 'ln -s' to 'ln -sf'.
 
 USAGE
-   exit 1
+    exit 1
 }
 
 #------------------------------------------------------------------------------
@@ -59,6 +62,9 @@ USAGE
 unset forceUpdate
 unset findOpt
 
+# default ln option
+lnOpt="-s"
+
 # simple parse options
 while [ "$#" -gt 0 ]
 do
@@ -69,9 +75,10 @@ do
     -f)
         shift
         forceUpdate=1
+        lnOpt="-sf"
         ;;
     -*)
-        usage "unknown option/argument: '$*'"
+        usage "unknown option: '$*'"
         ;;
     *)
         break
@@ -79,7 +86,17 @@ do
     esac
 done
 
-baseDir=$1
+if [ $# -eq 1 ]
+then
+    baseDir=$1
+elif [ $# -eq 2 ]
+    baseDir=$1
+    lnOpt="$2"
+else
+    usage "ERROR: incorrect number of arguments"
+fi
+
+
 # convert incorrect path/dir/lnInclude to something sensible
 while [ "${baseDir##*/}" = lnInclude ]
 do
@@ -92,17 +109,6 @@ done
 incDir=$baseDir/lnInclude
 
 
-if [ $# -eq 1 ]
-then
-    lnOpt="-s"
-elif [ $# -eq 2 ]
-then
-    lnOpt="$2"
-else
-    usage "ERROR: incorrect number of arguments"
-fi
-
-
 if [ ! -d $baseDir ]
 then
     echo "$Script error: base directory $baseDir does not exist" 1>&2
@@ -136,7 +142,7 @@ echo "$Script: linking include files to $incDir"
 #
 # remove any broken links first (this helps when file locations have moved)
 #
-find -L . -type l -exec rm \{\} \;
+find -L . -type l -exec rm {} \;
 
 #
 # create links, avoid recreating links unless necessary
-- 
GitLab