2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
8 #-------------------------------------------------------------------------------
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
29 # Link all the source files in the <dir> directory into <dir>/lnInclude
31 # Usage: wmakeLnInclude [-f] <dir>
33 # The desired source files:
34 # *.C *.H *.h *.cpp *.cxx *.hpp *.hxx
38 # .#* (cvs recovered files)
39 #------------------------------------------------------------------------------
44 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
47 Usage: $Script [OPTION] dir
50 -f | -force force update
51 -s | -silent use 'silent' mode (do not echo command)
54 Link all the source files in the <dir> into <dir>/lnInclude
57 The '-f' option forces an update when the lnInclude directory already exists
58 and changes the default linking from 'ln -s' to 'ln -sf'.
64 #------------------------------------------------------------------------------
66 # default 'find' option
72 unset forceUpdate silentOpt
74 # simple parse options
78 -h |
-help) # provide immediate help
91 usage
"unknown option: '$*'"
103 usage
"ERROR: incorrect number of arguments"
107 # convert incorrect path/dir/lnInclude to something sensible
108 while [ "${baseDir##*/}" = lnInclude
]
110 baseDir
="${baseDir%/*}"
111 if [ "$baseDir" = lnInclude
]
116 incDir
=$baseDir/lnInclude
120 echo "$Script error: base directory $baseDir does not exist" 1>&2
126 [ "$forceUpdate" = true
] ||
{
127 # echo "$Script error: include directory $incDir already exists" 1>&2
135 echo "$Script error: failed to create include directory $incDir" 1>&2
141 #------------------------------------------------------------------------------
143 if [ "$silentOpt" != true
]
145 echo "$Script: linking include files to $incDir" 1>&2
149 # remove any broken links first (this helps when file locations have moved)
151 find -L .
-type l
-exec rm {} \
;
154 # create links, avoid recreating links unless necessary
155 # things placed in the 'noLink' directory are skipped
158 \
( -name lnInclude
-o -name Make
-o -name config
-o -name noLink \
) -prune \
159 -o \
( -name '*.[CHh]' -o -name '*.[ch]xx' -o -name '*.[ch]pp' -o -name '*.type' \
) \
160 -exec ln $lnOpt {} . \
;
162 #------------------------------------------------------------------------------