2 #---------------------------------*- sh -*-------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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> [-lnOption]
33 # The desired source files:
34 # *.C *.H *.h *.cpp *.cxx *.hpp *.hxx
38 # .#* (cvs recovered files)
39 #------------------------------------------------------------------------------
43 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
46 usage: $Script [-f] <dir> [-lnOption]
48 Link all the source files in the <dir> into <dir>/lnInclude
51 The '-f' option forces an update when the lnInclude directory already exists
52 and also changes the default linking from 'ln -s' to 'ln -sf'.
58 #------------------------------------------------------------------------------
60 # simple option parsing
67 # simple parse options
71 -h |
-help) # provide immediate help
80 usage
"unknown option: '$*'"
96 usage
"ERROR: incorrect number of arguments"
100 # convert incorrect path/dir/lnInclude to something sensible
101 while [ "${baseDir##*/}" = lnInclude
]
103 baseDir
="${baseDir%/*}"
104 if [ "$baseDir" = lnInclude
]
109 incDir
=$baseDir/lnInclude
114 echo "$Script error: base directory $baseDir does not exist" 1>&2
120 if [ ! "$forceUpdate" ]
122 # echo "$Script error: include directory $incDir already exists" 1>&2
131 echo "$Script error: failed to create include directory $incDir" 1>&2
140 echo "$Script: linking include files to $incDir"
143 # remove any broken links first (this helps when file locations have moved)
145 find -L .
-type l
-exec rm {} \
;
148 # create links, avoid recreating links unless necessary
149 # things placed in the 'noLink' directory are skipped
152 \
( -name lnInclude
-o -name Make
-o -name config
-o -name noLink \
) -prune \
153 -o \
( -name '*.[CHh]' -o -name '*.[ch]xx' -o -name '*.[ch]pp' -o -name '*.type' \
) \
154 -exec ln $lnOpt {} . \
;
156 #------------------------------------------------------------------------------